234k views
2 votes
A) Input the value of length and breadth. find the area of rectangle. b) input the number and check whether it is even or odd.

5) 5
5 5
5 5 5
5 5 5 5
5 5 5 5 5 (urgent need. thank you!)​

1 Answer

5 votes

a) To find the area of a rectangle, we need to multiply its length and breadth. Let's say the length and breadth are given as L and B respectively. Then, the area (A) can be calculated as:

A = L x B

For example, if the length and breadth are 7 and 5 respectively, then:

A = 7 x 5

A = 35

Therefore, the area of the rectangle is 35.

b) To check whether a number is even or odd, we need to divide it by 2. If the remainder is 0, then the number is even, otherwise, it is odd.

Let's say the number we want to check is N. Then, we can use the modulo operator (%) to find the remainder when N is divided by 2. If the remainder is 0, then the number is even, otherwise, it is odd.

For example, if the number is 7, then:

7 % 2 = 1

Since the remainder is 1, the number is odd.

Now, let's check whether each of the given numbers is even or odd:

5 is odd

5 5 is not a valid number

5 5 5 is not a valid number

5 5 5 5 is not a valid number

5 5 5 5 5 is not a valid number

Therefore, the only valid number in the list is 5, which is odd.

User Jade Hamel
by
8.3k points

No related questions found