write the program for prime numbers?
Answer Posted / nitesh sanwal
#include<stdio.h>
#include<math.h>
void main()
{
int n,i,prime=1;
printf("input the numbers");
scanf("%d",&n);
for(i=2;i<=sqrt(n);i++)
if(n%i==0)
{
prime=0;
break;
}
if(prime)
printf("%d is a prime number",n);
else
printf("%d is a not a prime number",n);
}
Is This Answer Correct ? | 6 Yes | 3 No |
Post New Answer View All Answers
What are c identifiers?
What are the different types of data structures in c?
Explain what are binary trees?
What is unsigned int in c?
What is the size of structure pointer in c?
What is 'bus error'?
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
c program to compute AREA under integral
What is the right way to use errno?
What is scope of variable in c?
What standard functions are available to manipulate strings?
What are the application of void data type in c?
What is the use of function overloading in C?
What is the process to generate random numbers in c programming language?
What Is The Difference Between Null And Void Pointer?