Sunday, July 21, 2013

Program to print the multiplication of a given numbers using "for loop"

#include<iostream.h>
#include<conio.h>
void main()
{
int n;
clrscr();
cout<<"Enter an integer number : ";
cin>>n;
for(i=1;i<=10;i++)
cout<<i<<" * "<<n<<" = "<<i+n;
getch();
}

output of this program if i enter number 5 :-

Enter an integer number :
5
1 * 5 = 5
2 * 5 = 10
3 * 5 = 15
4 * 5 = 20
5 * 5 = 25
6 * 5 = 30
7 * 5 = 35
8 * 5 = 40
9 * 5 = 45
10 * 5 = 50

To know about loop click here

No comments:

Post a Comment