Area of Square,Triangle and Circle - C - A5P8

/* Write a program to find Area of Square,Triangle and Circle  */

#include<stdio.h>
#include<conio.h>
void square(int,int);
void triangle(int,int);
void circle(int);

const float pi=3.14;

void main()
{
    int len,brd,radi,base,height;
    clrscr();
    printf(":: Enter Value for find Area of Square ::\n");
    printf("Enter Length -> ");
    scanf("%d",&len);
    printf("Enter Breadth -> ");
    scanf("%d",&brd);
    square(len,brd);

    printf("\n\n:: Enter Value for find Area of Triangle ::\n");
    printf("Enter Base -> ");
    scanf("%d",&base);
    printf("Enter Height -> ");
    scanf("%d",&height);
    triangle(base,height);

    printf("\n\n:: Enter value for find Area of Circle ::\n");
    printf("Enter Radious -> ");
    scanf("%d",&radi);
    circle(radi);
    getch();
}
void square(int l,int b)
{
    int area;
    area=l*b;
    printf("\nArea of Squre -> %d \n",area);
}
void triangle(int b,int h)
{
    float area;
    area=0.5 * b * h ;
    printf("\nArea of Triangle -> %.2f \n",area);
}
void circle(int r)
{
    float area;
    area=pi*r*r;
    printf("\nArea of Circle -> %.2f \n",area);
}

Post a Comment