Multiply the Middle Number with Maximum of Three Numbers
For Complete YouTube Video: Click Here
In this class, we will understand Multiply the Middle Number with Maximum of Three Numbers.
The entire course of C Programming with more than 110+ videos of content or playlist has already been published.
We have covered all the concepts of C Programming in a very detailed way.
C Programming Complete Playlist on YouTube: Click Here
All the concepts discussed in this course are the models frequently asked in Campus Placements Questions, either in multiple-choice questions or as programming questions.
This entire course will help a Computer Science Engineering Student or a student in any other stream crack the campus placements drives held by Service-based Software or IT companies like TCS, Infosys, CTS, Wipro, Accenture, etc.
Table of Contents
Multiply the Middle Number with Maximum of Three Numbers
Question
Multiply the Middle Number with Maximum of Three Numbers is a very frequently asked question type.
The inputs are provided with three numbers from those three numbers we have to identify the middle number and we have to multiply the maximum number with the middle number.
For that, we have to find the maximum number, minimum number, and middle number.
The sample test cases are as shown below.
TESTCASE 1
Input
5,7,4
Expected return value:
35
TESTCASE 2
Input
11,12,13
Expected return value:
156
Given Code:
#include<stdio.h> int multiplynumber(int a, int b, int c) { int result, min, max, mid; max=(a>b)?((a>c)?a: c((b>c)?b: c); min=(a<b)?((a<c)?a: c((b<c)?b: c); mid=(a + b + c)-(min + max); result=(max*mid); return result; }
In the above code, there are some mistakes in the ternary operator.
The explanation of the question is provided in the above youtube link.