Completely Solved C, C++ Programs Assignment.




C Program to print prime numbers between 1 to 100

Filed Under:

Problem 34. C Program to print prime numbers between 1 to 100
#include<stdio.h>
#include<conio.h>
main( )
{
int n, i, check;
clrscr();
for(i=1;i<=100;i++)
{
check=1;
for(n=2;n<=i/2;n++)
if(i%n= =0)
{
check=0;
break;
}
if(check= =1)
printf(“n %d is a prime”,i);
else
printf(“n %d is not a prime”,i);
}
getch( );
}

C compiler: gcc 4.1.2

 Back to main directory: Sample C Program | Software Practical | Solved C Assignment


Get Free Programming Tutorials and Solved assignments