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 / d.sukumar

void main()
{
int i,k;int count=0;
int n;
printf("enter a no");
scanf("%d",&n);
for(i=2;i<=n;i++)
{
k=n%i;
if(k==0)
{
count++;
}
}
if(count==1)
printf("prime");
else
printf("not prime");
}

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

.main() { char *p = "hello world!"; p[0] = 'H'; printf("%s",p); }

1320


What is memcpy() function?

1132


I heard that you have to include stdio.h before calling printf. Why?

1082


What is the method to save data in stack data structure type?

1097


What is the use of ?: Operator?

1148


What is the use of getchar functions?

1197


What language is c written?

1068


What is the equivalent code of the following statement in WHILE LOOP format?

1314


Write a Program to find whether the given number or string is palindrome.

1292


What is calloc()?

1085


What is the use of a semicolon (;) at the end of every program statement?

1523


what is bit rate & baud rate? plz give wave forms

1996


Explain threaded binary trees?

1174


What is the stack in c?

1176


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

1060