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 I remove the trailing spaces from a string?
Explain what does the function toupper() do?
What do you mean by a sequential access file?
What is function definition in c?
What is the modulus operator?
What are linker error?
What is the use of getchar() function?
Explain which function in c can be used to append a string to another string?
What is c programming structure?
What are qualifiers in c?
why use "return" statement a) on executing the return statement it immediately transfers the control back to the calling program b) it returns the value present in the parentheses return, to the calling program c) a & b d) none of the above
What is variable in c example?
What are the 4 types of functions?
How can I invoke another program (a standalone executable, or an operating system command) from within a c program?
Differentiate fundamental data types and derived data types in C.