+ 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.
2 odpowiedzi
+ 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
+ 1
for (int i = 1 ; i <= 10; i++)
cout << "2 * " << i << " = " << (i * 2) << endl;