New help ASAP HW due today.

Here is the problem:
"Write a program that asks the user to enter a number.
Then it outputs the multiplication table for this number.
Sp, e.g. if the user enters 3, the programs outputs
This is what i have so far....

#include <iostream>
using namespace std;

int main ()
int n;
int i=1;
cout<<"Enter a number.";
cin>> n;
while (i<13);
while (i<13);
return 0;
Have you tried actually outputting i, n, and the result of i*n?
closed account (D80DSL3A)
You're close. The first while (i<13); will go forever. Remove that line.

This line of code i*n; can be modified to complete the program.
Just do the output right there!
You've got the basic structure alright; but you aren't outputting anything. You just need a cout statement in your loop. You just need to output the current iteration (i), the entered number (n) and the product of the two (i*n), along with some formatting.

You also need to remove the ";" after your while statement, and also your "do" and second while statement.
Last edited on
I got it Thanks!!! have another one which is a bit harder than this one.....
Topic archived. No new replies allowed.