write the program for prime numbers?
Answer Posted / umesh prajapati
/* find the number is prime or not prime. umesh prajapati*/
#include<stdio.h>
#include<conio.h>
void main()
{
int n,c,r;
clrscr();
printf("ENTER THE VALUE");
scanf("%d",&n);
if(n==2)
printf("THE NUMBER IS CO-PRIME");
else
{
c=2;
while(c<n)
{
r=n%c;
if(r==0)
{
printf("GIVEN NUMBER IS NOT PRIME");
break;
}
c++;
}
if(r>0)
printf("GIVEN NUMBER IS PRIME");
}
getch();
}
| Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
What is pointer to pointer in c language?
Are enumerations really portable?
1234554321 1234 4321 123 321 12 21 1 1 12 21 123 321 1234 4321 1234554321
I was asked to write a program in c which when executed displays how many no.of clients are connected to the server.
What are 'near' and 'far' pointers?
Is a house a shell structure?
Difference between Shallow copy and Deep copy?
What is the difference between far and near in c?
Why is c so popular?
What is sizeof array?
What is modeling?
What are header files and explain what are its uses in c programming?
Explain what is the difference between functions getch() and getche()?
Is this program statement valid? INT = 10.50;
What is the difference between array and pointer in c?