Question

Using C++ 1. Create a while loop that counts even numbers from 2 to 10 2....

Using C++

1. Create a while loop that counts even numbers from 2 to 10 2. Create a for loop that counts by five (i.e. 0, 5, 10, ...) from 0 to 100 3. Ask for a person's age and give them three tries to give you a correct age (between 0 and 100) 4. Use a for loop to list Celsius and Fahrenheit temperatures. The "C" should be from -20 to 20 and the F should be shown correspondingly (F = (9/5)*C+32). 5. The Fibonacci numbers are 1,1,2,3,5,8,13,21, etc. Use a for loop to list the first 20 Fibonacci numbers 6. Create a triangle using 2 for loops and the "*". 7. Check if a number is prime. 8. Output a list of numbers from 100 to 1 (using a for loop) to a file 9. Use a loop to output all the squares (i.e. 1,4, 9, 16, etc) to a file 10. Take a number such as 47321 and output it backwards to get 12374

0 0
Add a comment Improve this question Transcribed image text
Answer #1

//1 program
#include <iostream>
using namespace std;

int main()
{
int i=2,c=0;;
while(i<=10)
{
if(i%2==0)
c++;

i++;
}
cout<<"Total even no. form 2 to 10 :"<<c;
return 0;
}

//2 program
#include <iostream>
using namespace std;

int main()
{
int i=0,c=0;;
while(i<=10)
{
if(i%5==0)
c++;

i++;
}
cout<<"Total multiple of 5 form 0 to 100 :"<<c;
return 0;
}

#include <iostream>
using namespace std;

int main()
{
int age,i=0;
do{
if(i>2)
break;
cout<<"Enter the age:" ;
cin>>age;
i++;
  
  
  
}while(age<=0 || age>=100);
  
}

#include <iostream>
using namespace std;

int main()
{
int c;
float f;
for(c=-20 ;c<=20;c++)
{
f=(9.0/5.0)*c+32;
cout<<f<<endl;
}
  
}

Add a comment
Know the answer?
Add Answer to:
Using C++ 1. Create a while loop that counts even numbers from 2 to 10 2....
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT