Monday, January 7, 2013

Program to Calculate Are of a Triangle



C/C++ Program to Calculate Are of a Triangle



#include<iostream.h>
#include<conio.h>
#include<stdio.h>

int main(){
clrscr();
float b,h,x;

    cout<<"             \" This program will show area of a Triangle. \""<<endl<<endl;

    cout<<"What is the Base ?. Give a number."<<endl;
       cin>>b;
    cout<<"What is the Hight ?. Give a number."<<endl;
       cin>>h;
       x=(b*h)/2;

    cout<<endl;
    cout<<"You have given Base   :"<<b<<endl;
    cout<<"You have given Hight  :"<<h<<endl;
    cout.precision(2);
    cout<<"So area of this Triangle :"<<x;

getch();
}

No comments:

Post a Comment