#include ; using namespace std; int main () { int number1 = 0; int number2 = 0; int number3 = 0; int number4 = 0; int number5 = 0; coutnumber2>>number3>>number4>>number5; {if (number1 > number2) if (number1 > number3) if (number1 > number4) if (number1 > number5) cout
The smallest value is -32,768 and the maximum is 32,767
{ // set up our input buffer BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String currentLine; // store our ints in a list int smallest = 0; int largest = 0; // counter int numIntsRead = 0; // force smallest and largest to start as the first proper int entered while (numIntsRead < 1) { currentLine = in.readLine(); try { // convert from string to int int currentNumber = Integer.parseInt(currentLine); smallest = currentNumber; largest = currentNumber; ++numIntsRead; } catch (final NumberFormatException ex) { // we go here if the user didn't type in an integer } } // loop until we read all 5 ints while (numIntsRead < 5) { currentLine = in.readLine(); try { // convert from string to int int currentNumber = Integer.parseInt(currentLine); if (currentNumber < smallest) { smallest = currentNumber; } if (currentNumber > largest) { largest = currentNumber; } ++numIntsRead; } catch (final NumberFormatException ex) { // we go here if the user didn't type in an integer } } // display our findings System.out.println("Smallest:\t" + smallest); System.out.println("Largest:\t" + largest); }
0xffffffffffffffff As an unsigned 64-bit integer, this represents the value 18,446,744,073,709,551,615. However, as a signed 64-bit integer, this only represents the value -1. The signed range is -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 making 0x7fffffffffffffff the largest possible positive value, and 0x8000000000000000 the smallest possible negative value.
final double[] ns = new double[10]; final Random rnd = new Random(System.currentTimeMillis()); // Fill... for (int i = 0; i < ns.length; ++i) { ns[i] = rnd.nextDouble(); } // Get largest/smallest... double largest = Double.MIN_VALUE; double smallest = Double.MAX_VALUE; for (double n : ns) { if (n > largest) { largest = n; } if (n < smallest) { smallest = n; } } // largest and smallest are now the proper values.
#include #include #include int main(int argc, char *argv[]){int n, smallest, largest, sum, temp;if(argc < 2){printf("Syntax: foo val1[val2 [val3 [...]]]\n");exit(1);}smallest = largest = sum = atoi(argv[1]);for(n = 2; n < argc; n++){temp = atoi(argv[n]);if(temp < smallest) smallest = temp;if(temp > largest) largest = temp;sum += temp;}printf("Smallest: %i\nLargest: %i\nAverage: %i\n", smallest, largest, sum / (argc - 1));return 0;}
For x, which is the largest integer of nconsecutive positive integers of which the smallest is m:x = m + n - 1
Let the smallest integer be 2n, the next integer is 2n + 2, and the largest one is 2n + 4. Then, we have:2n + (2n + 2) = (2n + 4) + 164n + 2 = 2n + 202n = 18 the smallest integer2n + 2 = 18 + 2 = 20 the next one2n + 4 = 18 + 4 = 22 the largest integerCheck
The smallest positive integer is 1. The largest negative integer is -1. 1 > -1
There is no largest integers: they go on for ever.
Suppose the middle integer is 2a. Then the smallest is 2a-2 and the biggest is 2a+2. 4 times the smallest is 8a-8 So largest subtracted from the smallest is (8a-8) - (2a+2) = 6a-10 So, 6a-10 = 2*2a = 4a so that 2a = 10 So the integers are 8, 10 and 12.
If the largest integer is subtracted from four times the smallest, the result is 4 more than twice the middle integer. Let the smallest integer be x, then the others are x + 2 and x+ 4. Therefore 4x - (x + 4) = 2 (x + 2 ) + 4 Expanding, we get 4x -x -4 = 2x + 4 + 4 Gathering terms: x = 12 Thus the three integers are 12, 14 and 16.
YES
-3
-1: Negative integers become smaller as their absolute value increases. Therefore, the first negative integer is the smallest. This answer assumes that -0 is excluded because 0 is neither positive nor negative.
Start with the largest and end with the smallest
The smallest 5 digit integer is -99999. The largest 5 digit integer is 99999. The sum is therefore 0.
var largest : integer largest = array[0] for n : integer in array if n > largest largest = n endif endfor return largest