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
Is null always defined as 0(zero)?
Is return a keyword in c?
a parameter passed between a calling program and a called program a) variable b) constant c) argument d) all of the above
i have to apply for rbi before that i need to know the the syllabus for the entrance questions. whethet it may be aps or techinical
what do the 'c' and 'v' in argc and argv stand for?
code for find determinent of amatrix
What are the types of data types and explain?
Is there any demerits of using pointer?
Write a progarm to find the length of string using switch case?
What is the use of bit field?
When a c file is executed there are many files that are automatically opened what are they files?
What is atoi and atof in c?
How can type-insensitive macros be created?
How does selection sort work in c?
Explain which of the following operators is incorrect and why? ( >=, <=, <>, ==)