write the program for prime numbers?
Answer Posted / venkat reddy
#include<stdio.h>
main()
{
int i,n,count=0;
printf("enter a no.");
scanf("%d",&n);
for(i=2;i<n;i++)
{
if(n%i==0)
{
count++;
}
}
if(count>1)
{
printf("not prime no.");
}
else
printf("prime");
}
| Is This Answer Correct ? | 344 Yes | 155 No |
Post New Answer View All Answers
Can we compile a program without main() function?
write a program to print largest number of each row of a 2D array
What does the message "automatic aggregate intialization is an ansi feature" mean?
What is #ifdef ? What is its application?
Difference between malloc() and calloc() function?
1) There is a singing competition for children going to be conducted at a local club. Parents have been asked to arrive at least an hour before and register their children’s names with the Program Manager. Whenever a participant registers, the Program Manager has to position the name of the person in a list in alphabet order. Write a program to help the Program Manager do this by placing the name in the right place each time the Program Manger enters a name. 2) the Event Manager has to send participants to the stage to perform in the order in which they registered. Write a program that will help the Event Manager know who to call to the stage to perform. The Logic should be in Data Structures
Is c a great language, or what?
how do you write a function that takes a variable number of arguments? What is the prototype of printf () function?
Distinguish between actual and formal arguments.
What is a c token and types of c tokens?
Can a function be forced to be inline? Also, give a comparison between inline function and the C macro?
Explain what is the difference between far and near ?
Why doesnt long int work?
How can I do graphics in c?
How do shell structures work?