how to find out the maximum number out of the three inputs.
Answers were Sorted based on User's Feedback
Answer / hsandeep007
Hi Angads,
here is the code that need to implement.
I used java..
class largeNum{
public static void main(String args[])
{
int i,j,k;
i = Inter.parseInt(args[0]);
j = Inter.parseInt(args[1]);
k = Inter.parseInt(args[2]);
if (i>j && i>k)
{
system.out.print("i is max" + i);
}
else if(j>i && j>k)
{
system.out.print("j is max" + j);
}
else if(k>i && k>j)
{
system.out.print("k is max" + k);
}
}
}
| Is This Answer Correct ? | 32 Yes | 13 No |
Answer / dapumptu
If the inputs are a, b, and c,
max = a;
if (b > max) max = b;
if (c > max) max = c;
now max will contain the largest of the three.
| Is This Answer Correct ? | 17 Yes | 6 No |
Answer / ceeemor
#include<iostream>
using namespace std;
int main() {
int num[3];
cout << " Input 3 integers : ";
for (int i =0; i <3; i++) {
cin >> num[i];
}
sort(num, num+3);
cout << " The largest num in the given input s : " << num
[2] << endl;
return 0;
}
| Is This Answer Correct ? | 14 Yes | 5 No |
//Single statement code using ternary operator
int max(int a, int b, int c)
{
return (((a > b) ? a : b) > c) ? ((a > b) ? a : b) : c;
}
| Is This Answer Correct ? | 14 Yes | 8 No |
Answer / leonard a wilson iii
//Done in c#
//using x,y,z to test the outcome as maximium
double x=45,y=25,z=2,maximium=0;
if (z != Math.Max(x,y))
maximium=Math.Max(x,z);
Console.WriteLine("x={0},y={1},z={2} the max
is{3}", x, y, z, maximium);
//Leonard A Wilson III
| Is This Answer Correct ? | 6 Yes | 8 No |
using repetition structure. Write a c program that will accept five numbers. The program should count and output the total count of even numbers and total count of add numbers.
write a function – oriented program that calculates the sum of the squares from 1 to n. thus, if the input is 3, the output is 14
A Binary no. is given, we hav to find it's decimal equivalent.
write a program that accepts a number and outputs its equivalent in words. take note that the maximum input is 3000
Show by induction that 2n > n2, for all n > 4.
2 Answers Karvy, Qatar University,
write a program to convert temperature from fa height into celcius and vise versa,use modular programming
0 Answers Jomo Kenyatta University,
How do I store linked list datas into an array?
A string of charaters were given. Find the highest occurance of a character and display that character. eg.: INPUT: AEGBCNAVNEETGUPTAEDAGPE OUTPUT: E
develop a program to calculate and print body mass index for 200 employees
0 Answers Jomo Kenyatta University,
write a program using 2 D that searches a number and display the number of items 12 inputs values input 15,20, 13, 30, 38, 40,16, 18, 20 ,18 ,20 enter no. to search : 20
how to find out the maximum number out of the three inputs.
6 Answers ABC, Apple, C3I, HP, TCS,
Wrie a function which returns the most frequent number in a list of integers. Handle the case of more than one number which meets this criterion. public static int[] GetFrequency(int[] list)