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 / ashwini kumar nayak

#include<stdio.h>
#include<conio.h>

void main()
{
clrscr();
int c,i,n;
c=0;
printf("Enter the number");
scanf("%d",&n);
if(n==1)
printf("Number is the special number");
else
{
for(i=2;i<n;i++)
if (n%i==0)
{
c=1;break;
}
if(c!=1)
printf("prime");
else
printf ("not a prime");
}
getch();

}

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Write a program to generate the Fibinocci Series

1233


What are void pointers in c?

995


What is a example of a variable?

1015


What is volatile variable in c with example?

1043


Can the sizeof operator be used to tell the size of an array passed to a function?

1114


How do I convert a string to all upper or lower case?

1109


When should a type cast be used?

1010


Explain what is the benefit of using an enum rather than a #define constant?

1220


In a byte, what is the maximum decimal number that you can accommodate?

1138


Are the variables argc and argv are always local to main?

1020


What are the types of arrays in c?

1174


What is the use of ?: Operator?

1137


Explain what are run-time errors?

1086


Where static variables are stored in memory in c?

1001


Explain modulus operator.

1053