Thursday, 3 November 2016

Program to Calculate area of a Triangle using Fuction

#include<conio.h>
#include<iostream.h>
float areaoftriangle(float b,float h);
void main()
{
clrscr();
float x,y,z;
cout<<"Enter base of the Triangle ";
cin>>x;
cout<<"Enter height of the Triangle ";
cin>>y;
z=areaoftriangle(x,y);
cout<<"Area of the Triangle = "<<z;
getch();
}
float areaoftriangle(float b,float h)
{
float ar;
ar=0.5*b*h;
return(ar);
}

No comments:

Post a Comment

Basic Implementation of Array as a Pointer

#include<iostream.h> #include<conio.h> void main() { clrscr();   int arr[5];   cout<<"Enter 5 nos. ";   f...