Hello all,
Im a beginner and I need a hint.
Code:
// Counter controlled loop
// Multiplication table
#include <iostream.h>
#include <conio.h>
void main()
{
const int limit = 10;
int number;
int count = 1;
cout << "Multiplication Table";
cout<< endl << endl;
cout << "Please enter an integer number: ";
cin >> number;
while (count <= limit)
{
cout << count << "times" << number
<< "=" << count * number << endl;
count++;
}
}
getch();
Nice & easy
I was trying to modify this table by making it print the multiplication table for the numbers 1 to 12.
I though if I can get the variable number in a nested loop it should do the job.
After a bit of thinking I come up with this:
It doesnt give any syntax error but also doest do the job.
I tried different ways but I guess my lack of knowledge is the problem:
Code:
// Counter controlled loop
// Multiplication table
#include <iostream.h>
#include <conio.h>
void main()
{
const int limit = 10;
int number = 1;
int count = 1;
int counter = 1;
const int table = 12;
cout << "Multiplication Table";
cout<< endl << endl;
while (number <= table)
{
while (count <= limit)
{
cout << count << "times" << number
<< "=" << count * number << endl;
count++;
}
number++;
}
}
getch();
Any suggestions...
-Fizz