write the program for prime numbers?
Answer Posted / arafat buet
#include<stdio.h>
int main()
{
int i,n,r;
printf("enter any number:");
scanf("%d",&n);
if(n==1)
printf("not prime\n");
for(i=2;i<n;i++)
{
r=n%2;
if(r==0)
{
printf("\nnot prime\n");
break;
}
}
if(i==n)
printf("prime\n");
return 0;
}
| Is This Answer Correct ? | 24 Yes | 19 No |
Post New Answer View All Answers
A text file that contains declarations used by a group of functions,programs,or users a) executable file b) header file c) obj file d) .cfile
What is the difference between the local variable and global variable in c?
What does the error message "DGROUP exceeds 64K" mean?
What is the difference between array and structure in c?
What is main return c?
What is the method to save data in stack data structure type?
can we change the default calling convention in c if yes than how.........?
Write a program with dynamically allocation of variable.
p*=(++q)++*--p when p=q=1 while(q<=6)
Hi can anyone tell what is a start up code?
if the area was hit by a virus and so the decrease in the population because of death was x/3 and the migration from other places increased a population by 2x then annually it had so many ppl. find our the population in the starting.
What’s a signal? Explain what do I use signals for?
What are qualifiers and modifiers c?
How would you rename a function in C?
When was c language developed?