The program is writen in C++, please modify this program so that it asks for a u
ID: 3549907 • Letter: T
Question
The program is writen in C++, please modify this program so that it asks for a users input instead of just using 4. Then properly align the results into a square like the example.
Example output:
Enter the size of the table: 4
0 0 0 0 0
0 1 2 3 4
0 2 4 6 8
0 3 6 9 12
0 4 8 12 16
Here is my code thus far
#include<iostream>
using namespace::std;
int main(void)
{
int M = 4;
int N = 4;
for(int i = 0; i <= M;i++)
{
for(int j = 0; j <= N; j++)
{
cout << i*j<< "";
}
}
}
Explanation / Answer
please rate - thanks
#include<iostream>
using namespace::std;
int main(void)
{int M = 4;
int N = 4;
cout<<"enter the size of the table: ";
cin>>M;
N=M;
for(int i = 0; i <= M;i++)
{
for(int j = 0; j <= N; j++)
{
cout << i*j<<" ";
}
cout<<endl;
}
system("pause");
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.