Quick actions

cmd+k|ctrl+k

Navigation

Languages

main driven program

Snippet info

Language

C

Visibility

public

Author

krishnakanth

Created

2022-11-25T05:31:05.092229Z

Updated

2022-11-25T05:32:08.905087Z

#include <stdio.h>
#include <stdlib.h>

void main(void) {

    int choice , l ,w ,b,h ,r ;
    float area ;
    printf("Input 1 for area of circle \n");
    printf("Input 2 for area of rectangle \n");
    printf("Input 3 for area of triangle \n");
    printf("Input Your choice:");
    scanf("%d",&choice);
    switch(choice){
        case 1 :
            printf("enter the radius of circle :");
            scanf("%d",&r);
            area = 3.14*r*r ;

            break;
        case 2:
            printf("enter the length of rectangle :");
            scanf("%d",&l);
            printf("\nenter the width of rectangle :");
            scanf("%d",&w);
           area = l * w ;
          break;
        case 3:
            printf("enter the height of triangle :");
            scanf("%d",&h);
            printf("\nenter the base of triangle :");
            scanf("%d",&w);
            area = .5 * b * h;
          break;
        default :
            printf("Wrong Input ! please select the correct input");


    }
     printf("\nYour area %f",area);


}
INFO