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 are called c variables?

1127


What is sizeof in c?

1055


What is the stack in c?

1228


How do you write a program which produces its own source code as output?

1175


Describe dynamic data structure in c programming language?

1140


What is difference between static and global variable in c?

1103


How can I manipulate strings of multibyte characters?

1158


code for quick sort?

2085


What is indirection? How many levels of pointers can you have?

1206


What does s c mean on snapchat?

1186


Explain Basic concepts of C language?

1237


What is the default value of local and global variables in c?

1099


What is array within structure?

1174


Why is c still so popular?

1101


Can you please explain the difference between syntax vs logical error?

1241