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
How can I delete a file?
What is pointer and structure in c?
Why is c called a mid-level programming language?
What does c mean in standard form?
Write the control statements in C language
Explain what are compound statements?
how should functions be apportioned among source files?
What does main () mean in c?
Why c is procedure oriented?
what is the c source code for the below output? 5555555555 4444 4444 333 333 22 22 1 1 22 22 333 333 4444 4444 5555555555
What is the benefit of using an enum rather than a #define constant?
Difference between Shallow copy and Deep copy?
What are unions in c?
Write a program to generate a pulse width frequency of your choise,which can be variable by using the digital port of your processor
What are the modifiers available in c programming language?