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
Can variables be declared anywhere in c?
Why doesnt that code work?
How many bytes are occupied by near, far and huge pointers (dos)?
What is the size of structure in c?
What is the purpose of main( ) in c language?
What are categories used for in c?
Iam a B.Tech graduate and completed my engineering in 2009, from 2005 to 2009 and after that i had done nothing.Now i want to do job and get into BPO field . Friends give me suggestions as what to say in interview... if they ask me that what would you had done ... these many years without doing job ??????? pls urgent
Is c call by value?
Is linux written in c?
Explain what is wrong with this program statement?
How can I remove the leading spaces from a string?
What is the difference between procedural and declarative language?
Where register variables are stored in c?
How do you use a 'Local Block'?
What is the code in while loop that returns the output of given code?