4) Write a program to take user any input from 2 to 30 and print table of that number.

Anonymous School

            (Minds of Hacker)

--------------------------------


Write a program to take user any input from 2 to 30 and print table of that number.


C++ Practical



#include<iostream>

using namespace std;

int main()
{
    int i=1,table,num;
    cout<<"Enter the number\n";
    cin>>table;
    if (table >30 || table<2)
    {
        cout<<"Enter number between 2-30\n";
    }
    else
    {
        cout<<"\nTable of "<<table<<"\n\n";
        while (i!=11)
        {
            num=table*i;
            cout<<num<<"\n";
            i++;
        }
        
    }
    
    
}


Output:


Enter the number 5 Table of 5 5 10 15 20 25 30 35 40 45 50



 *******************Don't Make Learning Hard*****************



Follow us on :-

1) YouTube Channel :- Click Here

2) Blog                     :- Click Here


NextGen Digital... Welcome to WhatsApp chat
Howdy! How can we help you today?
Type here...