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
What are called c variables?
What is sizeof in c?
What is the stack in c?
How do you write a program which produces its own source code as output?
Describe dynamic data structure in c programming language?
What is difference between static and global variable in c?
How can I manipulate strings of multibyte characters?
code for quick sort?
What is indirection? How many levels of pointers can you have?
What does s c mean on snapchat?
Explain Basic concepts of C language?
What is the default value of local and global variables in c?
What is array within structure?
Why is c still so popular?
Can you please explain the difference between syntax vs logical error?