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 / arafat buet

#include<stdio.h>
int main()
{
int i,n,r;
printf("enter any number:");
scanf("%d",&n);
if(n==1)
printf("not prime\n");
for(i=2;i<n;i++)
{
r=n%2;
if(r==0)
{
printf("\nnot prime\n");
break;
}
}
if(i==n)
printf("prime\n");
return 0;
}

Is This Answer Correct ?    24 Yes 19 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Write a program on swapping (100, 50)

1166


How is pointer initialized in c?

1090


What is #include stdio h and #include conio h?

1176


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

1347


What functions are used in dynamic memory allocation in c?

1119


What are the primitive data types in c?

1131


What is the difference between functions getch() and getche()?

1137


Is calloc better than malloc?

1075


Write a program to generate a pulse width frequency of your choise,which can be variable by using the digital port of your processor

3600


What is scope rule of function in c?

1149


Where define directive used?

1142


what is the role you expect in software industry?

2198


how do you write a function that takes a variable number of arguments? What is the prototype of printf () function?

1981


Is fortran faster than c?

1082


What is extern keyword in c?

1184