Computer Science, asked by BINAYKUMARMANDAL, 1 year ago

Write A programme to find the area of triangle;circle and square.


mebijay: Which language do you want the program to be in ?
Anonymous: which Language can u please tell ?
mebijay: bhai konsa language me programming karte ho school me ? c++ or java or python ?

Answers

Answered by varunmadkaikar
0

#include <stdio.h>

void main()

{

   int fig_code;

   float side, base, height, area, radius;

   printf("-------------------------\n");

   printf(" 1 --> Circle\n");

   printf(" 2 --> Triangle\n");

   printf(" 3 --> Square\n");

   printf("-------------------------\n");

   printf("Enter the Figure code\n");

   scanf("%d", &fig_code);

   switch(fig_code)

   {

   case 1:

       printf("Enter the radius\n");

       scanf("%f", &radius);

       area = 3.142 * radius * radius;

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

       break;

   case 2:

      printf("Enter the base and height\n");

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

       area = 0.5 * base * height;

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

       break;

   case 3:

       printf("Enter the side\n");

       scanf("%f", &side);

       area = side * side;

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

       break;

   default:

       printf("Error in figure code\n");

       break;

   }

}

Similar questions