In this example to generate the multiplication table of 7 using for loop.
C++ Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | #include<iostream> using namespace std; int main() { int num, i, tab; num=7; cout<<"Table of "<<num<<" is \n\n"; for(i=1; i<=10; i++) { tab=num*i; cout<<num<<" * "<<i<<" = "<<tab<<"\n"; } } |