c++ Basic program: Writing a table...

Posted on at


 

 

 Writing a table in C++...

In this program i will show you how you can write table for any number using c++ program using for loop.

 

#include<iostream.h>

#include<conio.h>

 

int main()

{

float num, multi ;

cout<<" enter any number for table(e.g. 2.0 for table of 2)="<<endl;

cin>>num

cout<<"enter limit for which you want to write the table="<<endl;

cin>>l;

for(int a; a<=l;a++)

{

cout<<num <<"x"<<a<<"="<<num*a<<endl;

}

getch();

return 0;

}

 

Sample Output:

enter any number for table(e.g. 2.0 for table of 2)=3.0

enter limit for which you want to write the table=5

3.0X1=3.0

3.0X2=6.0

3.0X3=9.0

 3.0X4=12.0

3.0X5=15.0

 

If this blog is informative than please buzz and comment.If you find any mistake than please inform me.

Thanks



About the author

noshaba-bibi

I am Noshaba Bibi ,24 years old ,
done Mcs from Virtual university and I am a blogger.

Subscribe 0
160