Tuesday, April 7, 2015

38. Write a program to display all prime numbers from 1 to 100.


#include<stdio.h>
#include<conio.h>
void main()
{
int i,j;
clrscr();
for(i=1;i<l00;i++);
{
for(j=2;j<i;j++)
{
if(i%j==0)
{
break;
}
if(i==j)
printf("%5d",i);
}
getch();
}

No comments:

Post a Comment