write the program for prime numbers?
Answer Posted / awais
A PROG TO CHECK ANY NUMBER IS PRIME OR NOT BY USING IF ELSE STATEMENT
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int x;
printf("enter number");
scanf("%d",&x);
if(x==1)
{
printf("the number is neither composite nor prime");
}
else if(x==2)
{
printf("the number is prime");
}
else if(x%2==0)
{
printf("the number is not prime");
}
else if(x%2!=0)
{
printf("the number is prime");
}
getch();
}
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
How does free() know explain how much memory to release?
what is ur strangth & weekness
which of the following statement is wrong a) mes=123.56; b) con='T'*'A'; c) this='T'*20; d) 3+a=b;
What are the types of type specifiers?
What is string in c language?
What is this pointer in c plus plus?
Once I have used freopen, how can I get the original stdout (or stdin) back?
Is array name a pointer?
How can I access an I o board directly?
What is pass by reference in functions?
What is unary operator?
Are the expressions * ptr ++ and ++ * ptr same?
What is the difference between array and pointer in c?
What should malloc(0) do? Return a null pointer or a pointer to 0 bytes?
What is hashing in c language?