write the program for prime numbers?
Answer Posted / sikendar kumar
#include<stdio.h>
#include<conio.h>
main()
{
int i,n,count=0;
clrscr();
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");
return 0;
}
| Is This Answer Correct ? | 2 Yes | 2 No |
Post New Answer View All Answers
How a string is stored in c?
Why isn't any of this standardized in c? Any real program has to do some of these things.
Can we use visual studio for c?
How can I write data files which can be read on other machines with different word size, byte order, or floating point formats?
HOW TO SOLVE A NUMERICAL OF LRU IN OS ??????
Why is c not oop?
What is the main difference between calloc () and malloc ()?
Write a program to find the biggest number of three numbers in c?
swap 2 numbers without using third variable?
Write a C program in Fibonacci series.
What is class and object in c?
What is "Duff's Device"?
Without Computer networks, Computers will be half the use. Comment.
Difference between linking and loading?
What is #include conio h?