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