Printing table || do while || C++
In this, we are going to see do-while loop, the program is based on do-while loop which prints, the table of the number inputted by user.

The code given below can be used for TURBO C++ Compiler:-

    #include<iostream.h>
#include<conio.h>

void main()
{  
    clrscr();
    int n;
    int i=1;
    cout<<"Enter the no. to get its table : \n";
    cin>>n;
    do
    {
        cout<<n<<" * "<<i<<" = "<<n*i<<endl;
        i++;
    }
    while(i<=10);
    getch();
}
    
    

The code given below can be used for g++/gcc Compiler:-

    #include<iostream>
using namespace std;

int main()
{  
    int n;
    int i=1;
    cout<<"Enter the no. to get its table : \n";
    cin>>n;
    do
    {
        cout<<n<<" * "<<i<<" = "<<n*i<<endl;
        i++;
    }
    while(i<=10);
    return 0;
}
    
    

#ENJOY CODING

Post a Comment

FOR ANY DOUBTS AND ERRORS FEEL FREE TO ASK. YOUR DOUBTS WILL BE ADDRESSED ASAP

Previous Post Next Post