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 is LINKED LIST? How can you access the last element in a linked list?
Explain a pre-processor and its advantages.
Is it possible to execute code even after the program exits the main() function?
What is c definition?
write a C program:There is a mobile keypad with numbers 0-9 and alphabets on it. Take input 0f 7 keys and then form a word from the alphabets present on the keys.
What is oops c?
What is meant by int main ()?
What is function pointer c?
How is a structure member accessed?
How do you define CONSTANT in C?
How we can insert comments in a c program?
What is the difference between array and linked list in c?
What's the right way to use errno?
What is the purpose of 'register' keyword in c language?
How does sizeof know array size?