Tuesday, 29 March 2016

Write a program to form table of 2 using for loop in c++ language.

//wap to form table of 2 using for loop in c++ language.
 

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

void main()
{

clrscr();

int a=2,b=1,c,n;
cout<<"Table of 2 is :-"<<endl;
for(n=1;n<=10;n++)
{
c=a*b;
cout<<a<<"*"<<b<<"="<<c<<"\n";
b=b+1;
}getch();
}

Output:-
               
 



 

No comments:

Post a Comment