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

remove duplicates from sorted array - two pointer approach (leetcode)

  class Solution {     public int removeDuplicates ( int [] nums ) {         // base case: return if array have no el.         if ( nums...