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
Want to know how to write a C program that connects to a MySQL server and checks if the InnoDB plug-in is installed on it. If so, your program should print the total number of disk writes by MySQL.
Explain c preprocessor?
Which one would you prefer - a macro or a function?
C program execution always begins with a) #include b) comment (/*-------*/) c) main() d) declaration instructions
Why do we use int main?
What do you mean by dynamic memory allocation in c?
What is omp_num_threads?
What is getch?
Is stack a keyword in c?
Is boolean a datatype in c?
What is calloc() function?
what are the advanced features of functions a) function declaration and prototypes b) calling functions by value or by reference c) recursion d) all the above
Which driver is a pure java driver
What is the purpose of void pointer?
What is a protocol in c?