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 a shell structure examples?
Difference between Function to pointer and pointer to function
What is graph in c?
Why does notstrcat(string, "!");Work?
In C programming, how do you insert quote characters (‘ and “) into the output screen?
What is the use of printf() and scanf() functions?
write a program to print data of 5 five students with structures?
write a program to find out prime number using sieve case?
write an algorithm to display a square matrix.
Is array name a pointer?
Why do we use pointer to pointer in c?
How many types of arrays are there in c?
How do you generate random numbers in C?
What are the functions to open and close the file in c language?
Write a program to find the biggest number of three numbers in c?