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 can you increase the allowable number of simultaneously open files?
what is the height of tree if leaf node is at level 3. please explain
What is void pointers in c?
4-Take two sets of 5 numbers from user in two arrays. Sort array 1 in ascending and array 2 in descending order. Perform sorting by passing array to a function mySort(array, sortingOrder). Then multiply both the arrays returned from function, using metric multiplication technique in main. Print result in metric format.
Why n++ execute faster than n+1 ?
What is the meaning of 2d in c?
explain what is fifo?
What are local static variables? How can you use them?
Hi can anyone tell what is a start up code?
Explain how many levels deep can include files be nested?
What will the preprocessor do for a program?
Differentiate between the = symbol and == symbol?
How to declare pointer variables?
What is a const pointer in c?
What is putchar() function?