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
#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;
}
Comments
Leave a comment