write the program for prime numbers?
Answer Posted / dinesh kumar.s
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,k,a;
clrscr();
printf("program created by dinesh mca anna university\n");
printf("enter the number\n");
scanf("%d",&a);
j=a;
if( a%2==0 || a%3==0 )
{
for(i=2;i<=a;i++)
if(a%i==0)
if (i==j)
{
printf("prime number");
break;
}
else
{
printf("not");
break;
}
}
else
{
printf("prime number");
}
getch();
}
| Is This Answer Correct ? | 1 Yes | 2 No |
Post New Answer View All Answers
What are pointers really good for, anyway?
What is #define?
Do character constants represent numerical values?
What are the features of c languages?
Once I have used freopen, how can I get the original stdout (or stdin) back?
What is the difference between exit() and _exit() function in c?
Define C in your own Language.
I have a varargs function which accepts a float parameter?
Is Exception handling possible in c language?
What is a lookup table in c?
What is a macro, and explain how do you use it?
What is volatile variable in c?
If you know then define #pragma?
What is #line?
What is the mean of function?