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
Explain what is page thrashing?
I just typed in this program, and it is acting strangely. Can you see anything wrong with it?
Write a code on reverse string and its complexity.
Why can't I perform arithmetic on a void* pointer?
Write a program to compute the similarity between two strings - The program should get the two strings as input - Then it will output one single number which is the percentage of similarity between the two strings
What is the difference between NULL and NUL?
What does sizeof int return?
What are directives in c?
What are two dimensional arrays alternatively called as?
explain what are pointers?
What is typeof in c?
What is getch c?
What is data structure in c and its types?
Explain how do you determine the length of a string value that was stored in a variable?
How can you tell whether two strings are the same?