Pages

Friday, March 28, 2025

code to print multiplication table of a number entered by an user in C++

#include <iostream>
#include <cmath>

// code to print multiplication table of a number entered by an user.
using namespace std;

int main(){
    int num;

    cout << "enter a num : ";
    cin >> num;

    for(int i = 1; i <= 10; i++){

        int multiply = num*i;

        cout << num << " " << "x " << i << " is " << multiply << endl;
    }
    return 0;

}

No comments:

Post a Comment

3Sum - Leetcode solution - How i turned into two-pointer approach?

  class Solution {     public List < List < Integer >> threeSum ( int [] nums ) {         Arrays . sort (nums); // first sort...