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
Write a program to find factorial of a number using recursive function.
How do you convert strings to numbers in C?
How many types of errors are there in c language? Explain
What is I ++ in c programming?
How can I read a binary data file properly?
what is the significance of static storage class specifier?
Is c is a low level language?
Are bit fields portable?
Is void a keyword in c?
Is c procedural or object oriented?
i have a written test for microland please give me test pattern
Is it cc or c in a letter?
What are run-time errors?
Why array is used in c?
What is extern variable in c with example?