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
all c language question
What are the types of assignment statements?
What is a pointer in c plus plus?
Write a progarm to find the length of string using switch case?
Explain the meaning of keyword 'extern' in a function declaration.
Between macros and functions,which is better to use and why?
What is the use of function in c?
What is volatile variable in c with example?
What is atoi and atof in c?
Why is c called "mother" language?
i have a written test for microland please give me test pattern
Which is the memory area not included in C program? give the reason
How do I use void main?
How does selection sort work in c?
write a program to print data of 5 five students with structures?