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 is the role of this pointer?
Do string constants represent numerical values?
What is a good data structure to use for storing lines of text?
What is sizeof int?
I was asked to write a program in c which when executed displays how many no.of clients are connected to the server.
How do you determine a file’s attributes?
What are the advantages of c preprocessor?
Function which gives a pointer to a binary trees const an integer value at each code, return function of all the nodes in binary tree.?
Compare array data type to pointer data type
What is the scope of static variable in c?
any function have arguments one or more OR not . it is compulsary a) any function compulsary have one or more arguments b) any function did not have arguments. It is not compulsary c) it is optional it is not compulsary d) none of the above
Why is it usually a bad idea to use gets()? Suggest a workaround.
What is a dynamic array in c?
Are the outer parentheses in return statements really optional?
Which is better between malloc and calloc?