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...

how can write all 1to 100 prime numbers using for loop,if and
break ?

Answer Posted / divyanshu

#include<iostream.h>
#incude<conio.h>
int main()
{
int x=100,i,p=1;
cout<<"enter the no.";
cin>>x;
for(i=2;i<x;i++)
{
if(x%i==0)
{
p=2;
break;
}
if(x==1)
{
cout<<"prime no.";
}
getch();
}

Is This Answer Correct ?    2 Yes 12 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the role of this pointer?

995


Do string constants represent numerical values?

1326


What is a good data structure to use for storing lines of text?

1037


What is sizeof int?

1051


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

2322


How do you determine a file’s attributes?

1019


What are the advantages of c preprocessor?

1212


Function which gives a pointer to a binary trees const an integer value at each code, return function of all the nodes in binary tree.?

1015


Compare array data type to pointer data type

969


What is the scope of static variable in c?

946


any function have arguments one or more OR not . it is compulsary a) any function compulsary have one or more arguments b) any function did not have arguments. It is not compulsary c) it is optional it is not compulsary d) none of the above

1060


Why is it usually a bad idea to use gets()? Suggest a workaround.

1691


What is a dynamic array in c?

1078


Are the outer parentheses in return statements really optional?

1054


Which is better between malloc and calloc?

1122