In Westeros, fighting ground is rectangular in shape. King of Westeros, Bran Stark decides to build a fence around the ground. In order to help the construction workers to build a straight fence, he planned to place a thick rope around the ground. He decided to buy a rope of length that exactly fits the boundary. He also wanted to cover the entire ground with a thick carpet during the rainy season. The carpet should also be bought in such a way that it exactly covers the entire ground. Being the three eyed Raven, he was lost in his thoughts and requested your help. Can you please help Bran by writing a program to find the exact length of the rope and the exact area of carpet that is required?
Answers
Answered by
0
Answer:
FENCING THE GROUNDcggh
Answered by
0
Answer:
written below-
Explanation:
Input consists of 2 integers. The first integer corresponds to the length of the ground and the second integer corresponds to the breadth of the ground.
Input (stdin)
50 20
Expected Output
Required length is 140 m
Required quantity of carpet is 1000 sqm
Test Case 2
Input (stdin)
121 23
Expected Output
Required length is 288 m
Required quantity of carpet is 2783 sqm
Program
#include <stdio.h>
int main()
{
int l,b;
scanf("%d%d",&l,&b);
printf("Required length is %d m\n",2*l+2*b);
printf("Required quantity of carpet is %d sqm\n",l*b);
return 0;
#SPJ3
Similar questions