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

#include <stdio.h>


int main (void)
{
int i, nb, count, test;
test = count = 0;
printf ("enter integer: ");
if (scanf ("%d", &nb) != 1)
return -1;

for (i = 2; i < nb; i++, count++)
if (nb % i == 0)
test = 1;
if (!test)
printf ("%d prime number, number of iterations = %dn",
nb, count);
else
printf ("%d is not a prime number, number of iterations
= %dn", nb,count);
return 0;
}

Is This Answer Correct ?    2 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How can a string be converted to a number?

982


Explain what is the difference between a free-standing and a hosted environment?

1139


What is volatile variable in c?

1059


why return type of main is not necessary in linux

2057


How to implement a packet in C

2846


What is the general form of function in c?

983


How many bytes are occupied by near, far and huge pointers (dos)?

1129


Explain how can I open a file so that other programs can update it at the same time?

1068


How can you tell whether a program was compiled using c versus c++?

1058


What is the concatenation operator?

1095


the number of measuring units from a arbitrary starting point in a record area or control block to some other point a) branching b) recording pointer c) none d) offset

1060


Difference between malloc() and calloc() function?

1147


What does calloc stand for?

1100


What is cohesion in c?

929


What is spaghetti programming?

1084