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 pointers? What are different types of pointers?
Explain what is the difference between text files and binary files?
What is fflush() function?
What is the purpose of main( ) in c language?
Explain what is a program flowchart and explain how does it help in writing a program?
Explain continue keyword in c
What does d mean?
What is the full form of getch?
What is I ++ in c programming?
What is a char c?
What are the standard predefined macros?
What language is c written?
Explain how do you print an address?
Is c weakly typed?
Explain Function Pointer?