Practical - 8 - Write a program to find the area of Triangle.

Practical - 8

Aim: Write a program to find the area of Triangle.

 

Program:

#include <stdio.h>

#include <conio.h>

 

void main()

{

    clrscr();

    int base, height, area;

 

    printf("Enter the base = ");

    scanf("%d", &base);

 

    printf("Enter the height = ");

    scanf("%d", &height);

 

    area = 0.5 * base * height;

 

    printf("\nThe area = %d", area);

    getch();

}

 

 

Output:

Enter the base = 6

Enter the height = 3

 

The area = 9

 

Algorithm:

Step-1: START

Step-2: Declare base, height, area.

Step-3: Enter the value of base and height.

Step-4: area = 0.5 * base * height.

Step-5: Display area.

Step-6: STOP.

 

Flowchart:




Post a Comment

0 Comments
* Please Don't Spam Here. All the Comments are Reviewed by Admin.