Answer to Question #285548 in C++ for Jeanelle

Question #285548

1.      Using the looping statement. Create a program that will display the following:

 

 

 

A.    5

10

15

20

25

30

 

 

B.     100 90 80 70 60 50 40 30 20 10

 

 

1
Expert's answer
2022-01-07T09:00:37-0500
#include <iostream>

int main()
{
    //Part A
    for(int i = 5; i <= 30; i+=5)
    {
        std::cout << i << "\n";
    }
    std::cout << "\n";

    //Part B
    for(int i = 100; i >= 10; i-=10)
    {
        std::cout << i << " ";
    }
    std::cout << "\n";

    return 0;    
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment