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
How to write a multi-statement macro?
How can I sort a linked list?
Write the test cases for checking a variable having value in range -10.0 to +10.0?
what do u mean by Direct access files? then can u explain about Direct Access Files?
What is I ++ in c programming?
The number of bytes of storage occupied by short, int and long are a) 2, 2 and 4 b) 2, 4 and 4 c) 4, 4 and 4 d) none
How can I call a function with an argument list built up at run time?
Differentiate between ordinary variable and pointer in c.
#define f(g,h) g##h main O int i=0 int var=100 ; print f ("%d"f(var,10));} wat would be the output??
Why do some versions of toupper act strangely if given an upper-case letter?
how do you programme Carrier Sense Multiple Access
What does typeof return in c?
Find duplicates in a file containing 6 digit number (like uid) in O (n) time.
Why static is used in c?
Explain logical errors? Compare with syntax errors.