Question: 2) Write a C program named as prime.c to display first n prime numbers. The value of n is input by user. Sample output:

2) Write a C program named as "prime.c" to display first n

2) Write a C program named as "prime.c" to display first n prime numbers. The value of n is input by user. Sample output: $cc -o prime prime.c $./prime Enter the value of n: 3 First 3 prime numbers are: 235 $./prime Enter the value of n: 6 First 3 prime numbers are: 2357 11 13 Attach the source code and sample output of your "prime.c" in the answer sheet. Upload "prime.c" into iCollege. Hint: To read input for an integer n, we can use scanf("%d", &n); To print out the value of an integer, we can use printf("%d ", n); " " is a new line character.

Step by Step Solution

3.47 Rating (163 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

include stdio h ... View full answer

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 Programming Questions!