Example Program For Multiplication Value Using For Loop In C++

Multiplication Table (Values) Using For Loop

/*  Example Program For Multiplication Table (Values) Using For Loop In C++
    little drops @ thiyagaraaj.com
 */
#include<iostream>
#include<conio.h>

using namespace std;

int main()
 {
    // Variable Declaration
    int table, range;
    // Get Input Value multiplication table
    cout << "Enter the multiplication table you want to print : ";
    cin >> table;

    // Get Input Value for Range
    cout << "Enter the range: ";
    cin >> range;
    
    //for Loop Block
    for (int i = 1; i <= range; ++i) {
        cout << table << " * " << i << " = " << table * i << endl;
    }
    // Wait For Output Screen
    getch();
    return 0;
}

Sample Output

Enter the multiplication table you want to print : 2                                                                                                                            

Enter the range: 64
2 * 1 = 2          
2 * 2 = 4          
2 * 3 = 6          
2 * 4 = 8          
2 * 5 = 10         
2 * 6 = 12
2 * 7 = 14         
2 * 8 = 16         
2 * 9 = 18         
2 * 10 = 20        
2 * 11 = 22        
2 * 12 = 24        
2 * 13 = 26        
2 * 14 = 28        
2 * 15 = 30        
2 * 16 = 32        
2 * 17 = 34        
2 * 18 = 36        
2 * 19 = 38        
2 * 20 = 40        
2 * 21 = 42
2 * 22 = 44        
2 * 23 = 46        
2 * 24 = 48        
2 * 25 = 50        
2 * 26 = 52        
2 * 27 = 54        
2 * 28 = 56        
2 * 29 = 58        
2 * 30 = 60        
2 * 31 = 62        
2 * 32 = 64        
2 * 33 = 66        
2 * 34 = 68        
2 * 35 = 70        
2 * 36 = 72
2 * 37 = 74        
2 * 38 = 76        
2 * 39 = 78        
2 * 40 = 80        
2 * 41 = 82        
2 * 42 = 84        
2 * 43 = 86        
2 * 44 = 88        
2 * 45 = 90        
2 * 46 = 92        
2 * 47 = 94        
2 * 48 = 96        
2 * 49 = 98        
2 * 50 = 100       
2 * 51 = 102
2 * 52 = 104       
2 * 53 = 106       
2 * 54 = 108       
2 * 55 = 110       
2 * 56 = 112       
2 * 57 = 114       
2 * 58 = 116       
2 * 59 = 118       
2 * 60 = 120       
2 * 61 = 122       
2 * 62 = 124       
2 * 63 = 126       
2 * 64 = 128