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

all c language question

2405


What are the types of assignment statements?

1037


What is a pointer in c plus plus?

1266


Write a progarm to find the length of string using switch case?

2041


Explain the meaning of keyword 'extern' in a function declaration.

1133


Between macros and functions,which is better to use and why?

2151


What is the use of function in c?

1161


What is volatile variable in c with example?

1011


What is atoi and atof in c?

1054


Why is c called "mother" language?

1250


i have a written test for microland please give me test pattern

2695


Which is the memory area not included in C program? give the reason

1913


How do I use void main?

1071


How does selection sort work in c?

1001


write a program to print data of 5 five students with structures?

2023