Programme To Print The Table of A Number: #Include Using Namespace STD Int Main
Programme To Print The Table of A Number: #Include Using Namespace STD Int Main
int main( )
int i,no,table=1;
cin>>no;
cout<<"Table of "<<no;
for(i=1;i<=10;i++)
table=no*i;
cout<<" \n"<<table;
cout<<"\n";
1
Sample programe:-
Output:-
2
2. Programme to show the reverse of a given number
#include <iostream>
int main()
cin>>n;
while(n!=0)
3
rem=n%10;
reverse=reverse*10+rem;
n/=10;
return 0;
Sample Programme:-
4
Output:-
int main()
int n,r,sum=0,temp;
5
scanf("%d",&n);
temp=n;
while(n>0)
r=n%10;
sum=sum+(r*r*r);
n=n/10;
if(temp==sum)
else
return 0;
Sample programme:-
6
Output:-
7
#include<iostream>
int main()
int number;
cin>>number;
if(number>0)
cout<<"Number is Positive";
else if(number<0)
cout<<"Number is Negative";
else
cout<<"Number is Zero";
8
Sample programme:-
Output:-
9
5. Programme to swap values of A & B
1. #include<iostream>
3.
5. {
6. b = a + b;
7. a = b - a;
8. b = b - a;
9. }
10.
12. {
13. int a, b;
14.
18. cout << "The two numbers after swapping become :" << endl;
10
20. cout << "Value of b : " << b << endl;
Sample programme:-
Sample output:-
11
6.Programme to print the multiplication table
/* C++ Program - Print Table of Number */
#include<iostream.h>
#include<conio.h>
void main()
clrscr();
cin>>num;
tab=num*i;
getch();
12
Sample programme:-
Sample output:-
13
7.Programme tocheck the greatest among three
#include<iostream.h>
#include<conio.h>
void main()
clrscr();
int a, b, c, big;
cin>>a>>b>>c;
big=a;
if(big<b)
if(b>c)
big=b;
else
big=c;
14
}
else if(big<c)
if(c>b)
big=c;
else
big=b;
else
big=a;
getch();
15