exercise repetition: - Write a code to display a table consisting of four rows and 11 columns. The first column should contain the numbers 1 through 4. The second and subsequent columns should contain the result of multiplying the number in the first column by the numbers 0 through 9.
1 0 1 2 3 4 5 6 7 8 9
2 0 2 4 6 8 10 12 14 16 19
3 0 3 6 9 12 15 18 21 24 27
4 0 4 8 12 16 20 24 28 31 36
1
Expert's answer
2014-11-10T03:31:15-0500
#include <iostream> using namespace std; int main() { int a[5][11]; for(int i=1;i<5;i++){ a[i][0]=i; cout <<a[i][0]<<" "; for(int j=0;j<10;j++) { a[i][j]=i*j; cout <<a[i][j]<<" "; } cout<<endl; } return 0; }
Comments
Leave a comment