Latest News
Wednesday, November 2, 2016

How to make a table of any digit in C++ using Dev-C++


Make a table of any digit or number in C++ language.
In this programme \t is (called escape sequence in C++ language) tab means \t = Tab and 1 Tab is equal to 8 spaces 
\t (Tap) will sow 8 spaces between two character or words.


#include<iostream>
#include<conio.h>
using namespace std;
main ()
{
int n,n1,n2,n3,n4,n5,n6,n7,n8,n9,n10;
cout<<"\t==================================="<<endl;
cout<<"\tEnter any number for table = ";
cin>>n;
cout<<"\t==================================="<<endl;
cout<<"\t"<<n<<"\tX\t1\t=\t"<<n<<endl;
n2=n+n;
cout<<"\t"<<n<<"\tX\t2\t=\t"<<n2<<endl;
n3=n2+n;
cout<<"\t"<<n<<"\tX\t3\t=\t"<<n3<<endl;
n4=n3+n;
cout<<"\t"<<n<<"\tX\t4\t=\t"<<n4<<endl;
n5=n4+n;
cout<<"\t"<<n<<"\tX\t5\t=\t"<<n5<<endl;
n6=n5+n;
cout<<"\t"<<n<<"\tX\t6\t=\t"<<n6<<endl;
n7=n6+n;
cout<<"\t"<<n<<"\tX\t7\t=\t"<<n7<<endl;
n8=n7+n;
cout<<"\t"<<n<<"\tX\t8\t=\t"<<n8<<endl;
n9=n8+n;
cout<<"\t"<<n<<"\tX\t9\t=\t"<<n9<<endl;
n10=n9+n;
cout<<"\t"<<n<<"\tX\t10\t=\t"<<n10<<endl;
cout<<"\t==================================="<<endl;
return 0;
}



This is an other logic of programme.


.


#include<iostream>
#include<conio.h>
using namespace std;
main()
{
int n;
cout<<"Pleas enter number for table"<<endl;
cin>>n;
cout<<n<<" X 1 ="<<n*1<<endl;
cout<<n<<" X 2 ="<<n*2<<endl;
cout<<n<<" X 3 ="<<n*3<<endl;
cout<<n<<" X 4 ="<<n*4<<endl;
cout<<n<<" X 5 ="<<n*5<<endl;
cout<<n<<" X 6 ="<<n*6<<endl;
cout<<n<<" X 7 ="<<n*7<<endl;
cout<<n<<" X 8 ="<<n*8<<endl;
cout<<n<<" X 9 ="<<n*9<<endl;
cout<<n<<" X 10 ="<<n*10<<endl;
return 0;
}

  • Blogger Comments
  • Facebook Comments

0 comments:

Post a Comment

Item Reviewed: How to make a table of any digit in C++ using Dev-C++ Rating: 5 Reviewed By: Unknown