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

What do you understand by normalization of pointers?

1060


Why is c called a structured programming language?

1282


What are shell structures used for?

1054


Is c procedural or functional?

1036


What is array of structure in c programming?

1291


Can a program have two main functions?

1131


.find the output of the following program? char*myfunc(char*ptr) { ptr +=3; return (ptr); } int main() { char*x,*y; x="HELLO"; y=myfunc(x); printf("y = %s ",y); return 0; }

2589


Explain why C language is procedural?

1226


Do you know the difference between exit() and _exit() function in c?

1062


I was asked to write a program in c which when executed displays how many no.of clients are connected to the server.

2372


How many levels deep can include files be nested?

1142


Write a c program to demonstrate character and string constants?

2192


Is c dynamically typed?

1164


C program execution always begins with a) #include b) comment (/*-------*/) c) main() d) declaration instructions

1056


Is it better to use malloc() or calloc()?

1118