10/31/2015

C++ Program To Print A Table Using For Loop

Problem :- Write C++ A Program To Print A Table Of Given Number Using For Loop

Logic :- Take A for loop and initialize with number you taken from user and put a condition that number multiply with 10 and in last condition increase a number by number see below

Syntax :- 

for(=number;i<=number*10;i=i+number)
cout<<i;

Solution :-

#include<iostream>
using namespace std;
int main()
{
    int i,num;
    
    cout<<"Enter Any Number To Print Table \n";
    cin>>num;
    
    for(i=num;i<=10*num;i=i+num)
    {
        cout<<i<<endl;
    }
    return 0;

}

Output:-


C++ Program To Print A Table Using For Loop

Ghanendra Yadav

Ghanendra Yadav

Hello, I Am Ghanendra Yadav Owner of This Blog, I am professional Blogger and Programmer. I Love Programming, Logo Making, And Banner Designing. My Highest Qualification is MCA From NIT Warangal. You Can Find Me On Social Media Through Below Link And If You Have Any Query Related To Programming And Other Subject Comment Below or You Can Mail Me I Will Try To Answer Within 24 Hours Email:- yghanendra@student.nitw.ac.in

Find me on Social Media

Facebook | Twitter | Google+ | RSS Feed

No comments:

Post a Comment