Advertisement
Guest User

Untitled

a guest
Aug 23rd, 2019
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<conio.h>
  3. int main()
  4. {
  5. float l, b, r,ca, cc, ra, rp;
  6.  
  7. //For rectangle
  8. printf("Enter the length of rectangle: ");
  9. scanf("%f", &l);
  10. printf("Enter the breadth of rectangle: ");
  11. scanf("%f", &b);
  12.  
  13. //For circle
  14. printf("Enter the radius of circle: ");
  15. scanf("%f", &r);
  16.  
  17. //Calculate area & perimeter of the rectangle...
  18. ra = l * b; //Area of Rectangle = Length x Breadth
  19. rp = 2 * (l + b); //Perimeter of Rectangle = 2 x (Length + Breadth) or addition of all sides
  20.  
  21. //Calculate are & circumference of the circle...
  22. ca = 3.14 * r * r; //Area of Circle = 2 x Pi x r^2 where Pi = 3.14
  23. cc = 2 * 3.14 * r; //Circumference of Circle = 2 x Pi x r
  24.  
  25. printf("\nThe area of the rectangle: %0.2f", ra);
  26. printf("\nThe perimeter of the rectangle: %.2f", rp);
  27. printf("\n\nThe area of the circle: %.2f", ca);
  28. printf("\nThe circumference of the circle: %.2f", cc);
  29.  
  30. return (0);
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement