WAP to print first 100 prime numbers using for loop
WAPto print first 100 prime numbers using for loop
#include<stdio.h>
#include<conio.h>
void main()
{
int a[70];
int i,k=1,j;
int count=0;
clrscr();
a[k]=1;
for(i=3;i<=100;i++)
{
for(j=2;j<i;j++)
{
if(i%j==0)
{
count=1;
}
}
if(count==0)
a[++k]=i;
count=0;
}
for(i=1;i<=k;i++)
{
printf("%d,",a[i]);
}
getch();
}