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

void main()
{
int i,n;
clrscr();
printf("\nEnter the range:");
scanf("%d",&n)
printf("Prime numbers are:");
for(i=1;i<=n;i++)
{
if(i==2 || i==3 || i==5 || i==7)
printf("%d ",i);
if(i%2!=0 && i%3!=0 && i%5!=0 && i%7!=0)
printf("%d ",i);
}
getch();
}

Is This Answer Correct ?    7 Yes 8 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Differentiate between Macro and ordinary definition.

1311


What are local static variables?

1107


What is the use of a static variable in c?

1027


What is the correct declaration of main?

1177


What does sizeof int return?

1036


Difference between constant pointer and pointer to a constant.

1089


What does the function toupper() do?

1082


If the size of int data type is two bytes, what is the range of signed int data type?

994


What is calloc in c?

1098


What is null in c?

1032


How macro execution is faster than function ?

1152


What is the process to create increment and decrement stamen in c?

1027


What is ponter?

1238


Why c is called a middle level language?

1073


Explain why c is faster than c++?

1033