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 |
Question 1: Implement a base class Appointment and derived classes Onetime, Daily, Weekly, and Monthly. An appointment has a description (for example, “see the dentist”) and a date and time. Write a virtual function occurs_on(int year, int month, int day) that checks whether the appointment occurs on that date. For example, for a monthly appointment, you must check whether the day of the month matches. Then fill a vector of Appointment* with a mixture of appointments. Have the user enter a date and print out all appointments that happen on that date. *This Should Be Done IN C++
Code for Easily Using Hash Table?
A Binary no. is given, we hav to find it's decimal equivalent.
readers and writers problem
How reader and writer problem was implemented and come up with effective solution for reader and writer problem in case we have n readers and 1 writer.
Implement a command console for changing settings on a particular object. The command console should allow you to enter a string and will return the response (very similar to a terminal session). The commands are as follows: SET propertyname=newvalue will change the target object’s member named “propertyname” to have a value equal to “newvalue”. If the input value is incompatible (i.e. an int being set to a string), print out an appropriate error message. GET propertyname will print out the current value of the target object’s member named “propertyname”. GET * will print out a list of all target object members and their current values. The system should be extensible for future commands and should accept an arbitrary object, such that another developer could insert another object into the system and rely on the command console to get and set the properties correctly.
0 Answers ABC, Guidance Software,
Given a table of the form: Product Sold on A 1/1/1980 B 1/1/1980 C 1/1/1980 A 1/1/1980 B 1/1/1980 C 2/1/1980 A 2/1/1980 There are 30 products and 10,000 records of such type. Also the month period during which sales happened is given to u. Write the program to display the result as: Product Month No. of copies A January 12 A February 15 A March 27 B January 54 B February 15 B March 10 C January 37
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
Given 1 to n random number, find top 10 maximum numbers and explain the time complexity of the algorithm.
i don't know about working of nested for loop can any one help me
write a program that accepts a number and outputs its equivalent in words. take note that the maximum input is 3000
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)