FastFoodCoding

Login


Connect with one of the following accounts





Login

Please wait while we redirect...

Views: 71   



Following program shows you how to print table for given number.
In this program we get number from user and print that number table using for loop

#include <iostream>

int main() {
    int input;
    std::cout << "Enter the number:";
    std::cin >> input;
    for (int i = 1; i <= 10; i++) {
        std::cout << input << " * " << i << " = " << input * i << "\n";
    }
}

Output:

Enter the number: 5
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



On By


Top Tutorials

Top Questions

Top Articles

Top Blogs

Top News