Tuesday, October 20, 2009

Find how many prime no's are in given five numbers
#include
void main()
{
int a[5],i,j,div=0,tot=0;
printf("\n Enter Five no.");
for(i=0;i<=4;i++)
scanf("%d",&a[i]);
for(i=0;i<=4;i++)
{
div=0;
for(j=1;j<=a[i];j++)
{
if(a[i]%j==0)
{
div=div+1;
}
}
if(div==2)
{
tot=tot+1;
}
}
printf(" no of prime no are %d",tot);
}

No comments:

Post a Comment