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 does a pointer variable always consist of?
How can I open a file so that other programs can update it at the same time?
What are different types of operators?
What is c preprocessor mean?
Where are c variables stored in memory?
What is boolean in c?
Synonymous with pointer array a) character array b) ragged array c) multiple array d) none
main() { int i = 10; printf(" %d %d %d ", ++i, i++, ++i); }
What is the method to save data in stack data structure type?
What is pointer to pointer in c with example?
Define and explain about ! Operator?
Explain output of printf("Hello World"-'A'+'B'); ?
What is the use of typedef in structure in c?
What is the use of linkage in c language?
What are the types of data types and explain?