To calculate the are of a Right angle triangle , we use the below below formula

C Code for calculating the Area of Right angle triangle and Circle together using switch in C .

// Area of a Right angle Triangle and Circle

#include<stdio.h>

#include<conio.h>

int main()

{

int base , height , x;

float area,radius ;

clrscr() ;

printf("Enter A number given below to proceed");

printf("\n Enter 1 for 90 degree Triangle Area ") ;

printf("\n Enter 2 for Circle Area");

printf("\n");

scanf("%d",&x);

switch(x)

{

case 1 :

printf("Enter the base length and height of triangle") ;

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

area=(base*height)/2 ;

printf("\n Area of this 90 degree triangle is = %f",area);

break ;

case 2 :

printf("Enter Radius of Circle");

scanf("%f",&radius);

area=3.14*radius*radius ;

printf("Area of Circle is = %f",area) ;

break ;

default :

printf("Enter a valid Input ... ") ;

}

getch();

return 0 ;

}

**area=(base*height)/2**and for Circle Area , we use the mathematical formula as**area=3.14*radius*radius**.C Code for calculating the Area of Right angle triangle and Circle together using switch in C .

// Area of a Right angle Triangle and Circle

#include<stdio.h>

#include<conio.h>

int main()

{

int base , height , x;

float area,radius ;

clrscr() ;

printf("Enter A number given below to proceed");

printf("\n Enter 1 for 90 degree Triangle Area ") ;

printf("\n Enter 2 for Circle Area");

printf("\n");

scanf("%d",&x);

switch(x)

{

case 1 :

printf("Enter the base length and height of triangle") ;

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

area=(base*height)/2 ;

printf("\n Area of this 90 degree triangle is = %f",area);

break ;

case 2 :

printf("Enter Radius of Circle");

scanf("%f",&radius);

area=3.14*radius*radius ;

printf("Area of Circle is = %f",area) ;

break ;

default :

printf("Enter a valid Input ... ") ;

}

getch();

return 0 ;

}

## Comments