Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

What is a shell structure examples?

1025


Difference between Function to pointer and pointer to function

1015


What is graph in c?

1004


Why does notstrcat(string, "!");Work?

1079


In C programming, how do you insert quote characters (‘ and “) into the output screen?

1474


What is the use of printf() and scanf() functions?

1066


write a program to print data of 5 five students with structures?

2002


write a program to find out prime number using sieve case?

2031


write an algorithm to display a square matrix.

2638


Is array name a pointer?

993


Why do we use pointer to pointer in c?

1018


How many types of arrays are there in c?

995


How do you generate random numbers in C?

1143


What are the functions to open and close the file in c language?

984


Write a program to find the biggest number of three numbers in c?

1004