Problem 58. C Program to print prime number between 1- 100
#include<stdio.h>
#include<conio.h>
main( ){
int i,n,c;
clrscr( );
for(n=1;n<=100;n++)
{
c=0;
for(i=1;i<=n;i++)
if(n%i==0)
c++;
if(c==2)
printf(“n%d”,n);
}
getch( );
}
C compiler: gcc 4.1.2
Back to main directory: Sample C Program | Software Practical | Solved C Assignment#include<stdio.h>
#include<conio.h>
main( ){
int i,n,c;
clrscr( );
for(n=1;n<=100;n++)
{
c=0;
for(i=1;i<=n;i++)
if(n%i==0)
c++;
if(c==2)
printf(“n%d”,n);
}
getch( );
}
C compiler: gcc 4.1.2