The lenght and breadth of a rectangle and radius of a circle are input through the keyboard . write a program to calculate the area and perimeter of the rectangle and the area and circumference of the circle.

// program to calculate area of rectangle and circle.
# include<stdio.h>

int main(){
    int l,b,r;
    float rectangle ,circle,area,perimeter,circumference;
    printf("Enter the lenght , breadth:\n ");
    scanf("%d%d",&l,&b);
    rectangle=l*b;
    perimeter=2*(l+b);
    printf("The Area of reactangle is %f and\n
perimeter of rectangle is %f\n",rectangle,perimeter);

    printf("Enter the Radius of the circle:\n");
    scanf("%d",&r);
    circle=3.14*r*r;
    circumference=2*3.14*r;
    printf("The Area of circle is %f
and \nthe circumference of circle is %f",
circle,circumference);


    return 0;
}
/*output*/
Enter the lenght , breadth: 2 3 The Area of reactangle is 6.000000 and perimeter of rectangle is 10.000000 Enter the Radius of the circle: 5 The Area of circle is 78.500000 and the circumference of circle is 31.400000

 

Comments

Popular posts from this blog

Loop control statement

Type conversion and Type Casting

Digraph and Trigraph characters in C