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 a program to print the prime numbers from 1 to 100?

Answer Posted / prth

#include<stdio.h>
#include<conio.h>
void main()
{
int flag,x;
clrscr();
printf("1\t");
for(int i=1;i<=100;i++)
{
flag=0;
for(x=2;x<=i;x++)
{
if(i%x==0)
{
flag=1;
break;
}
else
continue;
}
if(i==x)
printf("%d\t",i);
}
getch();
}

Is This Answer Correct ?    48 Yes 11 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How will you print TATA alone from TATA POWER using string copy and concate commands in C?

1333


Explain which of the following operators is incorrect and why? ( >=, <=, <>, ==)

984


please explain every phase in the "SDLC" in the dotnet.

2567


Is c easy to learn?

946


Are there constructors in c?

975


What is the 'named constructor idiom'?

1041


How can I automatically locate a programs configuration files in the same directory as the executable?

1113


Explain what is the benefit of using #define to declare a constant?

1108


Explain how do you determine the length of a string value that was stored in a variable?

1102


What extern c means?

943


What is the use of function in c?

1148


Which is not valid in C a) class aClass{public:int x;}; b) /* A comment */ c) char x=12;

1033


What are the key features in c programming language?

1019


Explain what is meant by high-order and low-order bytes?

1008


Why n++ execute faster than n+1 ?

2864