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 / paul

#include <stdio.h>
#include<stdlib.h>

#define TRUE 1
#define FALSE 0

int main()
{
int i,x,prime = TRUE;
printf(".:Modified Prime Program:.\n\n");
printf("Enter a number: ");
scanf("%d",&x);
printf("\nNUMBER\t REMARKS\n");
do
{
for(i=2;i<x;i++)
if(x%i==0)
{
prime=FALSE;
break;
}
if (prime=1 && (!(i<=x/2)))
printf("%d\t PRIME\n",x);
else
printf("%d\t COMPOSITE\n",x);
}
while (x-=1);
system ("pause");
return 0;
}

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the data types present in c?

1163


What is an lvalue in c?

1126


What is a sequential access file?

1178


How to throw some light on the b tree?

1088


What does static variable mean in c?

1108


hi send me sample aptitude papers of cts?

2166


What is wrong with this declaration?

1109


What is the size of empty structure in c?

1086


Which built-in library function can be used to match a patter from the string?

1303


what is the significance of static storage class specifier?

2263


What is a pointer on a pointer in c programming language?

1141


‘SAVEPOINT’ and ‘ROLLBACK’ is used in oracle database to secure the data comment. Give suitable examples of each with sql command.

2345


What is a program flowchart and how does it help in writing a program?

1141


How do c compilers work?

1134


What are external variables in c?

1107