Hi, im new to c++ and wondered if anyone could help me with this

Use a for loop to display 3 times table backwards

12 times 3 = 36
11 times 3 = 33
10 times 3 = 30
9 times 3 = 27
8 times 3 = 24
7 times 3 = 21
6 times 3 = 18
5 times 3 = 15
4 times 3 = 12
3 times 3 = 9
2 times 3 = 6
1 times 3 = 3

Make a for loop that starts from 12 to 1 (Decrementing here )
and then multiply 3 by the index and cout the result.

#include<iostream.h>

main(){
          int answer;    
          for(int index = 12; index >= 1; i--){
               answer=3*i;
               cout<<index<<" times 3 = "<<answer<<endl;
          }
}

Iwish that hels you GOOD LUCKk:D

commented: A few good advices: First learn English, then you should read the forum rules (you'll understand them, because you know English), then learn how to write good C++ code and after that maybe posting using code tags would be helpful as well! -1
commented: Don't people test their code anymore? -2
Member Avatar for iamthwee
#include<iostream.h>

main(){
          int answer;    
          for(int index = 12; index >= 1; i--){
               answer=3*i;
               cout<<index<<" times 3 = "<<answer<<endl;
          }
}

I wish that helps you GOOD LUCK :D

-iostream.h should be iostream
-it's int main
-you're mixing index with the variable i

commented: Agreed :) +7

Hi, im new to c++ and wondered if anyone could help me with this

Use a for loop to display 3 times table backwards

12 times 3 = 36
11 times 3 = 33
10 times 3 = 30
9 times 3 = 27
8 times 3 = 24
7 times 3 = 21
6 times 3 = 18
5 times 3 = 15
4 times 3 = 12
3 times 3 = 9
2 times 3 = 6
1 times 3 = 3

#include<iostream.h>

main(){
int multiply;
// for loop for 12 times
for(int count = 12;count >=  ;count--){
    multiply = 3*count;
   cout << count << "  times 3 = " <<multiply << endl;
}//for

return 0;
}

I hope you enjoy it.

Keep it simple:

for (int i = 12; i; i--)
  cout << i << " times 3 = " << 3*i << '\n';

;)

Here it goes..... text file attached!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.