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 |
What output does this program generate as shown? Why? class A { A() { cout << "A::A()" << endl; } ~A() { cout << "A::~A()" << endl; throw "A::exception"; } }; class B { B() { cout << "B::B()" << endl; throw "B::exception"; } ~B() { cout << "B::~B()"; } }; int main(int, char**) { try { cout << "Entering try...catch block" << endl; A objectA; B objectB; cout << "Exiting try...catch block" << endl; } catch (char* ex) { cout << ex << endl; } return 0; }
how to diplay a external image of output on winxp by using c & c++,
What will be the output- for(i=1;i<=3;i++) { printf("%d",i); continue; i++; }
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.
Definition of priority queue was given. We have to implement the priority queue using array of pointers with the priorities given in the range 1..n. The array could be accessed using the variable top. The list corresponding to the array elements contains the items having the priority as the array index. Adding an item would require changing the value of top if it has higher priority than top. Extracting an item would require deleting the first element from the corresponding queue. The following class was given: class PriorityQueue { int *Data[100]; int top; public: void put(int item, int priority); // inserts the item with the given priority. int get(int priority); // extract the element with the given priority. int count(); // returns the total elements in the priority queue. int isEmpty(); // check whether the priority queue is empty or not. }; We had to implement all these class functions.
0 Answers Nagarro, Wollega University,
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)
solve the problem in the programming language C++"if a five digit number is input through the keyboard.Write a program to calculate the sum of its digits(hint: use the modulus operator)
Assume in University Every student in university as entity, prepare a class for student that store the roll no, name, dob of student, and make funtion of deletion, manipulation, addition of student record.
Write a program that print in screen a tree with its height taken from user by entering number of 4 digits and find the odd numbers then calculate the sum of odd numbers so he get the height of tree?
Write code for the multiplication of COMPLEX numbers?
PROBLEM #8 The cashier at the counter of a Super Store, Mr. Khazaanchi has the following bundles of rupee cash notes with him: Rs. 1, 2, 5, 10, 50, 100, 500, 1000 A customer comes at his counter with various items that he has shopped. Mr. Khazaanchi totals the item prices and tells the customer his total amount payable. The customer gives Mr. Khazanchi some amount of cash. Find the total number of rupee notes of each denomination (i.e. 1, 2, 5, 10, 50, 100, 500, 1000) Mr. Khazaanchi will have to give to the withdrawer ensuring that the total number of rupee notes are minimum.
how to write a program that opens a file and display in reverse order?