Pages

Sunday 6 November 2011

Area of Circle


1.     Area of Circle

//Area of Circle
#include<iostream.h>
#include<conio.h>
void main()
{
float r,a;
cout<<"Enter the radius of circle";
cin>>r;
a=3.14*r*r;
cout<<"Area of Circle";
cout<<a;
getch();
}

Area of Rectangle


1.     Area of Rectangle

//Area of Rectangle
#include<iostream.h>
#include<conio.h>
void main()
{
int l,b,a;
cout<<"Enter the length";
cin>>l;
cout<<"Enter the breadth";
cin>>b;
a=l*b;
cout<<"Area of Rectangle";
cout<<a;
getch();
}

OUTPUT:
Enter the length 9
Enter the breadth 8
Area of Rectangle 72

AREA PROGRAMS


1.     Area of triangle

//Area of Triangle
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int b,h;
float a;
cout<<"Enter the base of triangle";
cin>>b;
cout<<"Enter the height of triangle";
cin>>h;
a=0.5*b*h;
cout<<"Area of triangle";
cout<<a;
getch();
}

Multiplication of two numbers


1.     Multiplication of two numbers

// Multiplication of two numbers
#include<iostream.h>
#include<conio.h>
void main()
{
int a,b,c;
cout<<"Enter the value of a";
cin>>a;
cout<<"Enter the value of b";
cin>>b;
c=a*b;
cout<<"Multiplication of two numbers";
cout<<c;
getch();
}

OUTPUT:
Enter the value of a4
Enter the value of b5
Addition of two numbers20

Subtraction of two numbers


1.     2. Subtraction of two numbers

// Subtraction of two numbers
#include<iostream.h>
#include<conio.h>
void main()
{
int a,b,c;
cout<<"Enter the value of a";
cin>>a;
cout<<"Enter the value of b";
cin>>b;
c=a-b;
cout<<"Subtraction of two numbers";
cout<<c;
getch();
}

OUTPUT:
Enter the value of a6
Enter the value of b5
Addition of two numbers1

Simple Programs in C++


SIMPLE PROGRAMS




1.     Addition of two numbers

// Addition of two numbers
#include<iostream.h>
#include<conio.h>
void main()
{
int a,b,c;
cout<<"Enter the value of a: ";
cin>>a;
cout<<"Enter the value of b: ";
cin>>b;
c=a+b;
cout<<"Addition of two numbers: ";
cout<<c;
getch();
}

OUTPUT:
Enter the value of a: 4
Enter the value of b: 5
Addition of two numbers: 9