Question: Complete the following C programs. Your files may use only standard library headers (stdio.h, stdlib.h, string.h, etc.) so that it will compile properly on our

Complete the following C programs. Your files may use only standard library headers (stdio.h, stdlib.h, string.h, etc.) so that it will compile properly on our linux systems.

1) read_input.c Program to read in n lines of input, each line is a two integers and a word. Output the input sorted by the first number. Your program should read from standard input, and the only output should be the sorted data (do not print "Type a number", etc.).

2) primes.c Let the first command-line argument to the program be in the variable n, an integer. Print the primes up to n. Use the prime test that checks primes up to the sqrt of the number. You may use the sieve of Eratosthenes as part of your program to make it faster. You program must complete the prime tests itself (no hard-coded primes allowed). For any arrays that are needed, you should declare these dynamically (with malloc) so the program will work for any value of n.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!