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
What do you understand by normalization of pointers?
Why is c called a structured programming language?
What are shell structures used for?
Is c procedural or functional?
What is array of structure in c programming?
Can a program have two main functions?
.find the output of the following program? char*myfunc(char*ptr) { ptr +=3; return (ptr); } int main() { char*x,*y; x="HELLO"; y=myfunc(x); printf("y = %s ",y); return 0; }
Explain why C language is procedural?
Do you know the difference between exit() and _exit() function in c?
I was asked to write a program in c which when executed displays how many no.of clients are connected to the server.
How many levels deep can include files be nested?
Write a c program to demonstrate character and string constants?
Is c dynamically typed?
C program execution always begins with a) #include b) comment (/*-------*/) c) main() d) declaration instructions
Is it better to use malloc() or calloc()?