#include <stdio.h>
main()
{
int a,i,b;
printf("enter no:");
scanf("%d",&a);
for(i=1;i<=a;a++)
if(a%i==0)
printf("the no is composite\n");
else
printf("the no is prime\n");
return 0;
}
main()
{
int a,i,b;
printf("enter no:");
scanf("%d",&a);
for(i=1;i<=a;a++)
if(a%i==0)
printf("the no is composite\n");
else
printf("the no is prime\n");
return 0;
}
2 Comments
this is not accurate program plz check and up load a accurate program ok
ReplyDeletethere must be a break statement while printing the statement ...so code will be like this
ReplyDelete#include
main()
{
int a,i,b;
printf("enter no:");
scanf("%d",&a);
for(i=2;i<=a;a++)
{
if(a%i==0)
{
printf("the no is composite\n");
break;
}
else
{
printf("the no is prime\n");
break;
}
}
return 0;
}