Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

C Program to print Prime Numbers

Let’s write a C Program to print list of Prime numbers. This program will be useful for you to understand the basic concepts in C programming such as,

  1. How to get a user input value in C
  2. How to write for loop in C
  3. How to get the remainder value using modules in C

See the script:

int main()
	int limit, i=0, j=0; 
	//print a string about the program
	printf("Let's print Prime Numbers\n");
    printf("Enter the Limit: ");
	//get the limit
	scanf("%d", &limit);
	//loop till i equals to limit
    for (i = 1; i 

The output of the program will be:


Just go through the comments in the above program to understand each line. Bye!

The post C Program to print Prime Numbers appeared first on TutorialsMade.

This post first appeared on TutorialsMade - Ultimate Tutorial, please read the originial post: here

Share the post

C Program to print Prime Numbers


Subscribe to Tutorialsmade - Ultimate Tutorial

Get updates delivered right to your inbox!

Thank you for your subscription