Académique Documents
Professionnel Documents
Culture Documents
#include<conio.h>
void main()
clrscr();
cout<<"HELLO";
getch();
output
2. WAP to find sum of two numbers
#include<iostream.h>
#include<conio.h>
void main()
int a,b,c;
clrscr();
cin>>a;
cin>>b;
c=a+b;
getch();
output
3. WAP to swap two numbers using third variable
#include<iostream.h>
#include<conio.h>
void main()
int a,b,c;
clrscr();
cin>>a;
cin>>b;
c=a;
a=b;
b=c;
cout<<a<<endl<<b;
getch();
output
4. WAP to find area of circle
#include<iostream.h>
#include<conio.h>
void main()
float r,a;
clrscr();
cin>>r;
a=3.14*r*r;
getch();
output
5. WAP to swap two numbers without using third variable
#include<iostream.h>
#include<conio.h>
void main()
clrscr();
cin>>a;
cin>>b;
a=a+b;
b=a-b;
a=a-b;
cout<<a<<endl<<b;
getch();
output
6. WAP to find reverse of any number
#include<iostream.h>
#include<conio.h>
void main()
clrscr();
cin>>n;
s=0;
while(n>0)
r=n%10;
s=s*10+r;
n=n/10;
Cout<<reverse :<<s;
getch();
}
output
#include<conio.h>
void main()
float a,b,c,d,e,t,p;
clrscr();
cin>>a;
cin>>b;
cin>>c;
cin>>e;
t=a+b+c+d+e;
p=(t/150)*100;
getch();
output
8. WAP to
find greatest
of three
numbers
#include<iostream.h>
#include<conio.h>
void main()
int a,b,c;
clrscr();
cin>>a;
cin>>b;
cin>>c;
if(a>b&&b>c)
cout<<"a is greatest";
else if(b>a&&b>c)
cout<<"b is greatest";
else
cout<<"c is greatest";
getch();
output
#include<iostream.h>
#include<conio.h>
void main()
clrscr();
int l,b,A,P;
cin>>l>>b;
A=l+b;
cout<<"area of rectagle"<<A;
P=2*(l+b);
cout<<endl<<"perimeter of rectangle"<<P;
getch();
Output