Answer to Question #206084 in C++ for Afhra

Question #206084

Write only the loop statements to print the following sequence .

1) 1 2 4 8 16

2) 1 2 4 6 10 15

3) 243 81 27 9

4) 111 222 333 444 555

5) 16 11 7 4 2 1

6) 1 1 2 3 5 8 13 21


1
Expert's answer
2021-06-11T22:33:32-0400


#include <iostream>


using namespace std;


int main()
{
 // 1 2 4 8 16
 for(int i=1;i<=16;i=i*2){
     cout<<i<<" ";
 }
cout<<"\n";
// 1 2 4 6 10 15
for(int i=1;i<=15;i=i+i){
     cout<<i<<" ";
 }
    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

LATEST TUTORIALS
New on Blog