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
Explain how do you determine the length of a string value that was stored in a variable?
What is break statement?
Explain what will be the outcome of the following conditional statement if the value of variable s is 10?
What are dangling pointers in c?
Is javascript written in c?
When is a null pointer used?
a sequence of bytes with one to one corrspondence to those in the external device a) sequential addressing b) address c) byte code d) none
List the difference between a "copy constructor" and a "assignment operator"?
The program will first compute the tax you owe based on your income. User is prompted to enter income. Program will compute the total amount of tax owed based on the following: Income Tax 0 - $45,000 = 0.15 x income $45,001 - $90,000 = 6750 + 0.20 x (income – 45000) $90,001 - $140,000 = 15750 + 0.26 x (income – 90000) $140,001 - $200,000 = 28750 + 0.29 x (income – 140000) Greater than $200,000 = 46150 + 0.33 x (income – 200000) Dollar amounts should be in dollars and cents (float point numbers with two decimals shown). Tax is displayed on the screen.
Is c high or low level?
What is the easiest sorting method to use?
What is the sizeof () operator?
Where is c used?
What is the use of #include in c?
How can I discover how many arguments a function was actually called with?