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
What is pivot in c?
How many levels of pointers have?
Can you pass an entire structure to functions?
Differentiate between Macro and ordinary definition.
Write a code to determine the total number of stops an elevator would take to serve N number of people.
What is the 'named constructor idiom'?
How do you override a defined macro?
What is a null pointer assignment error? What are bus errors, memory faults, and core dumps?
Why is not a pointer null after calling free? How unsafe is it to use (assign, compare) a pointer value after it is been freed?
how to print the character with maximum occurence and print that number of occurence too in a string given ?
What is exit() function?
Do pointers take up memory?
What is #line?
What is 'bus error'?
In c programming, explain how do you insert quote characters (? And ?) Into the output screen?