2 4 6 8 10
3 6 9 12 15
4 8 12 16 20
5 10 15 20 25
Seems simple huh?. Heres the sorce code showing the logic I followed (I didnt do any nested loops btw):
#include <iostream> #include <iomanip> using namespace std; void main() { int a,b,c,d; for (a=1; a < 11; a++) { a=a+1; cout<<setw(2)<<a<<setw(4); } cout<<endl; for (b=1; b < 16; b++) { b=b+2; cout<<setw(2)<<b<<setw(4); } cout<<endl; for (c=1; c < 21; c++) { c=c+3; cout<<setw(2)<<c<<setw(4); } cout<<endl; for (d=1; d < 26; d++) { d=d+4; cout<<setw(2)<<d<<setw(4); } cout<<endl; }
now, here the output:
2 4 6 810
3 6 91215
4 8121620
510152025
Press any key to continue
Notice how there is no space between 2-digit numbers. What could cause this? help would be really appreciated.