Wipro Elite Coding Problem #2 | Help Jackson

Today we are going to discuss some Wipro Elite Coding Questions that has been asked in previous years in Wipro for Project Engineer role for Freshers.

So, If you are appearing in Wipro Elite, then there are fair chances that you can get same difficulty level of questions in your actual exam.

Wipro elite coding problem 2

Hi all, Welcome to Jobs Adda. Here you would get all fresher jobs updates and placement material for engineering graduates related to IT/Core sector.

To get all job updates on time, Don’t forget to join our whatsapp group. Click below to join.


Jackson, a math research student, is developing an application on triangles in mensuration. For the two triangles on the application’s display, with base and height given, the user must identify the triangle with the largest area. Jackson must now write an algorithm to find the area of the larger triangle.

To find the area of a triangle with base and height given, the following formula is used: Area of a triangle = (base*height)/2. Write an algorithm to find the area of the largest triangle.

Input
The first line of the input consists of two space-separated positive integers – base1, height1, representing the base and height of the first triangle. The second line consists of two space-separated positive integers- base2, height2, representing the base and height of the second triangle.

Output
Print a real number representing the area of the largest triangle rounded up to 2 decimal places.

Constraints
0 ≤ base1, height1, base2, height2 ≤109

Example:

Input:
5 8
4 11

Output:
22.00

Explanation:
Area of the first triangle = 20.000000((5*8)/2).
Area of the second triangle = 22.000000((4*11)/2).
So, the output is 22.00

Solution:

#include<stdio.h>
int main()
{
    double b1,h1,b2,h2,a1,a2;
    scanf("%lf %lf %lf %lf",&b1,&h1,&b2,&h2);
    a1=(b1*h1)/2;
    a2=(b2*h2)/2;
    if(a1>a2)
        printf("%0.2lf",a1);
    else
        printf("%0.2lf",a2);
}

Leave a Reply

Your email address will not be published. Required fields are marked *