आसान 0 हल किए गए 0% स्वीकृति

Rectangle Perimeter

Compute the perimeter of a rectangle from its sides.

समस्या

A rectangle has two sides of length width and two sides of length height. Its perimeter is the total length of all four sides.

Implement rectangle_perimeter(width, height).

Input

width: The width of the rectangle. height: The height of the rectangle.

Output

Return the perimeter as an integer.

सीमाएँ

1 ≤ width, height ≤ 1,000,000

उदाहरण

उदाहरण 1
इनपुट:
width = 3
height = 5

अपेक्षित आउटपुट:
expected = 16
इनपुट:
long long width = 3;
long long height = 5;

अपेक्षित आउटपुट:
long long expected = 16;
इनपुट:
long width = 3;
long height = 5;

अपेक्षित आउटपुट:
long expected = 16;

व्याख्या

Two sides of 3 and two sides of 5: 3 + 3 + 5 + 5 = 16.

उदाहरण 2
इनपुट:
width = 7
height = 7

अपेक्षित आउटपुट:
expected = 28
इनपुट:
long long width = 7;
long long height = 7;

अपेक्षित आउटपुट:
long long expected = 28;
इनपुट:
long width = 7;
long height = 7;

अपेक्षित आउटपुट:
long expected = 28;

व्याख्या

A square is a rectangle too: 4 × 7 = 28.

संदर्भ

यह चुनौती CodeUtility के लिए अनुकूलित की गई है। ऊपर दिए गए स्टेटमेंट और सीमाओं का पालन करें।

दूसरों से सीखें

समुदाय समाधान

अभी तक कोई प्रकाशित समाधान नहीं। पहला साझा करने के लिए इस चुनौती को हल करें।