Thursday, May 7, 2015

write a program to calculate the area of the rectangle and circle

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

#include<stdio.h>
#include<conio.h>
main()
{
      int b,l,r,area1,perimeter;
      float area2,circum;
      printf("Enter the lenght & breadth of Rectangle");
      scanf("%d%d",&l,&b);
      printf("Enter the radius of circle");
      scanf("%d",&r);
      area1=l*b;
      area2=3.14*r*r;
      perimeter=2*(l+b);
      circum=2*3.14*r;
      printf("\n\nThe Area of Rectangle %d",area1);
      printf("\n\nThe Perimeter of Rectangle %d",perimeter);
                  printf("\n\nThe Area of Circle %f",area2);
                        printf("\n\nThe Circumferance of circle %f",circum);
      printf("\n\n\nEnter any key to exit....");
      getch();
     
      }
Output:-

No comments:

Post a Comment

Featured Post

What is JavaScript? What is the role of JavaScript engine?

  The JavaScript is a Programming language that is used for converting static web pages to interactive and dynamic web pages. A JavaScript e...