Research Area

Ashutosh Dubey

Sunday, March 13, 2011

Basic Programs

1.wap to enter the radius of a circle and print  the area……….

#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
cout<<"";
cout<<"submitted by gaurav gupta";
float a,b;
cout<<"enter the radius of a circle";
cin>>a;
b=(3.14*a*a);
cout<<"area="<<b;
getch();
}




2.wap to enter the radius of a circle and print the circumference………..

#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
cout<<" ";
cout<<" submitted by gaurav gupta";
float a,b;
cout<<" enter the radius of a circle";
cin>>a;
b=(2*3.14*a);
cout<<"circumference="<<b;
getch();
}


3.wap to enter the radius and height of the circle and print the volume of cylinder……..

#include<iostream.h>
#include<conio.h>
#include<math.h>
void main()
{
clrscr();
cout<<" ";
cout<<" submitted by gaurav gupta";
float a,b,v;
cout<<" enter the radius of cylinder  ";
cin>>a;
cout<<" enter he height of cylinder  ";
cin>>b;
v=(3.14*a*a*a*b)/3;
cout<<"volume of a cylinder is ="<<v;
getch();
}

4.wap o enter P,R,T and calculate the simple interest…

#include<iostream.h>
#include<conio.h>
#include<math.h>
void main()
{
clrscr();
cout<<" ";
cout<<" submitted by gaurav gupta";
float p,r,t,si;
cout<<" enter p ";
cin>>p;
cout<<" enter r ";
cin>>r;
cout<<" enter t";
cin>>t;
si=(p*r*t)/2;
cout<<"simple interest="<<si;
getch();
}


5.wap to enter he distance in km and convert it into m and cm……….

#include<iostream.h>
#include<conio.h>
#include<math.h>
void main()
{
clrscr();
cout<<" ";
cout<<" submitted by gaurav gupta";
float p,r,t,si;
cout<<" enter p ";
cin>>p;
cout<<" enter r ";
cin>>r;
cout<<" enter t";
cin>>t;
si=(p*r*t)/2;
cout<<"simple interest="<<si;
getch();
}


6.wap to enter the value and print the square and cube of number…..

#include<iostream.h>
#include<conio.h>
#include<math.h>
void main()
{
clrscr();
cout<<" ";
cout<<" submitted by gaurav gupta";
float a,b,c;
cout<<" enter he value of a ";
cin>>a;
b=(a*a);
c=(a*a*a);
cout<<"square="<<b<<"cube="<<c;
getch();
}


7.wap to enter a number and print he square root of the number…..

#include<iostream.h>
#include<conio.h>
#include<math.h>
void main()
{
cout<<" ";
cout<<"submitted by gaurav gupta";
float a,b;
cout<<"enter a";
cin>>a;
b=sqrt(a);
cout<<b;
getch();
}






8.wap to enter the sides of a triangle and calculate the area by heros formula………….

#include<iostream.h>
#include<conio.h>
#include<math.h>
void main()
{
cout<<" ";
cout<<" submitted by gaurav gupta";
float a,b,c,S,A;
cout<<" enter the value of a,b,c";
cin>>a>>b>>c;
S=(a+b+c)/2;
A=sqrt(S*(S-a)*(S-b)*(S-c));
cout<<"area="<<A;
getch();
}




9.wap to enter the bredth and height of a triangle and calculate the area……..

#include<iostream.h>
#include<conio.h>
#include<math.h>
void main()
{
clrscr();
cout<<" ";
cout<<" submitted by gaurav gupta";
float a,b,c;
cout<<" enter the bredth of triangle ";
cin>>a;
cout<<" enter the  of height of triangle ";
cin>>b;
c=(a*b)/2;
cout<<"area="<<c;
getch();
}



10.wap to enter a 3 digit number and print the sum………

#include<iostream.h>
#include<conio.h>
void main()
{
cout<<" ";
cout<<" submitted by gaurav gupta";
int a,b,sum=0;
cout<<" enter the value of a";
cin>>a;
b=a%10;
a=a/10;
sum=sum+b;
b=a%10;
a=b/10;
sum=sum+a+b;
cout<<sum;
getch();
}


11. wap to enter 3 digit number and print the reverse of the number….

#include<iostream.h>
#include<conio.h>
void main()
{
cout<<" ";
cout<<" submitted by gaurav gupta";
int a,b,rew=0;
cout<<" enter the value of a";
cin>>a;
b=a%10;
a=a/10;
rew=rew+b*100;
b=a%10;
a=b/10;
rew=rew+b*10+a;
cout<<rew;
getch();
}

No comments: