Fencing Ground

QUESTION

The college ground is rectangular in shape. The Management decides to build a fence around the ground. In order to help the construction workers to build a straight fence, they planned to place a thick rope around the ground. They wanted to buy only the exact length of the rope that is needed. They also wanted to cover the entire ground with a thick carpet during rainy season. They wanted to buy only the exact quantity of carpet that is needed. They requested your help.\n\nCan you please help them by writing a C program to find the exact length of the rope and the exact quantity of carper that is needed?\n\nInput Format:\nInput 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.\n\nOutput Format:\nRefer Sample Input and Output for exact formatting specifications.\n50\nEnter the width of the ground\n20\nThe length of the rope needed is 140m\nThe quantity of carpet needed is 1000sqm\n\n.

“TESTCASE_1”: “50 20\n###—###SEPERATOR—###—\nLength=140 m\nQuantity=1000 sqm”, “TESTCASE_2”: “45 33\n###—###SEPERATOR—###—\nLength=156 m\nQuantity=1485 sqm”, “TESTCASE_3”: “0\n###—###SEPERATOR—###—\n0”, “TESTCASE_4”: “0\n###—###SEPERATOR—###—\n0”, “TESTCASE_5”: “0\n###—###SEPERATOR—###—\n0

ANSWER

#include <stdio.h>
int main()
{
int l,b;
  scanf("%d %d",&l,&b);
  int len=2*(l+b);
  int area=l*b;
  printf("Length=%d m\n",len);
  printf("Quantity=%d sqm",area);
	return 0;
}
Ads Blocker Image Powered by Code Help Pro

Ads Blocker Detected!!!

We have detected that you are using extensions to block ads. Please support us by disabling these ads blocker.

Powered By
CHP Adblock Detector Plugin | Codehelppro