Write a C++ program to print table of each number stored in array using array and for loop.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | #include <iostream> using namespace std; int main() { int i,j; int array[3]={5,8,9}; for(i=0;i<3;i++) { for(j=1;j<11;j++) { int r= array[i]*j; cout<< array[i]<< "*" <<j<<"="<<r<<endl; } } return 0; } |
Output
5*1=5
5*2=10
5*3=15
5*4=20
5*5=25
5*6=30
5*7=35
5*8=40
5*9=45
5*10=50
8*1=8
8*2=16
8*3=24
8*4=32
8*5=40
8*6=48
8*7=56
8*8=64
8*9=72
8*10=80
9*1=9
9*2=18
9*3=27
9*4=36
9*5=45
9*6=54
9*7=63
9*8=72
9*9=81
9*10=90