C Program to Calculate Area and Perimeter of a Triangle

 #include<stdio.h>

void main()

{

    float base, height;

    int a, b, c;

    float area, perimeter;


    printf("Enter base and height of triangle: ");

    scanf("%f %f",&base,&height);


    area = 0.5 * base * height;


    printf("Enter three sides of triangle: ");

    scanf("%d %d %d",&a,&b,&c);


    perimeter = a + b + c;


    printf("Area of triangle = %f\n",area);

    printf("Perimeter of triangle = %f",perimeter);

}

Comments

Popular posts from this blog

Single Program Using All Automatic String Functions

C program for subtraction of two matrices (2D Arrays)

C program for Multiplication of Two matrices