SomeOne can perform a task in c++.. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

SomeOne can perform a task in c++..

create a table of 2,using for loop... maximum length upto 10....like that 2 * 1 = 2. 2 * 2 = 4.

9th Mar 2017, 12:02 PM
Zeeshan Salam
Zeeshan Salam - avatar
2 Answers
+ 1
This program uses a for loop to increment i by 2 : //Generate and display the progression 1-32 #include <iostream> using namespace std ; int main () { for ( int i = 1 ; i <= 10 ; i *= 2 ) cout << i << " " ; return 0 ; } Note : The i is increment by *2 each time the loop iterates
9th Mar 2017, 12:21 PM
handerson scott
handerson scott - avatar
+ 1
for (int i = 1 ; i <= 10; i++) cout << "2 * " << i << " = " << (i * 2) << endl;
9th Mar 2017, 1:27 PM
AtoMX
AtoMX - avatar