how to find largest number?

how to find largest number?

View Answers

January 29, 2009 at 10:43 PM

Hi

Can u please clarify your query, You want to find the greater number which user enter on the console?

Thanks...

January 29, 2009 at 11:13 PM

class Numbers{
public static void main(String args[]){
int i, max, min;
int no[] = {5,78,1,6,74,9,6,4,6,7};
System.out.println("\nElements in the Array: \n");

for(i=0; i < 10; i++){
System.out.print(no[i]+"\t");
}

System.out.println("\n");
max = no[0];
min = no[0];

for(i=1; i < 10; i++){
if(max < no[i]){
max = no[i];
}else if(min > no[i]){
min = no[i];
}
}
System.out.print("\nGreatest Number: "+ max);
System.out.print("\nSmallest Number: "+ min);
}
}

January 30, 2009 at 11:49 AM

yup yup..
i want to know how to find the greatest number that enter by the user..
sorry for not stating my question more clearer..
thanks









Related Tutorials/Questions & Answers:
how to find largest number? - Java Interview Questions
find largest value
Advertisements
generate random numbers and display the largest
Find Second Largest Number from an Array
USE ARRAY TO FIND THE LARGEST NUMBER AND OCCURRENCE
Java Find Automorphic numbers
Determine Average by removing Largest and Smallest Number
find the largest number enter by user - Java Interview Questions
Find Numbers which are palindrome and prime
To find first two maximum numbers in an array
Java find prime numbers without using break statement
how to add to numbers in java
Java Find Median
find largest num enter by user using loop method - Java Interview Questions
Find HCF of three numbers in Java Program
How to put text file numbers to array and check the position of numbers?
Find L.C.M. of two numbers in Java
How to generate a list of random numbers?
How to generate a list of random numbers?
How to generate a list of random numbers?
To find first two maximum numbers in an array,using single loop without sorting array.
To find first two maximum numbers in an array,using single loop without sorting array.
How to add two numbers in Java?
How to list even numbers between 1 and 100?
Pick Prime Numbers from the ArrayList
Find Twin Primes Number using Java
this code gives addition of 2 numbers in j2me..but the code is not executing ..can u pls find out the error...??
Find consecutive numbers whose sum is equal to input number.
how I make the numbers in descending order ?
Find sum of all the elements of matrix using Java
how to find square and cube of five number
How to print a equilateral triangle patren with numbers
how to find jdk path in ubuntu?
How to find hashtable size in Java?
How to Find PHP version and configuration?
how to find the given date is sunday
How to find run time in SQL.
How to find a servlet object by name?
How to find maximum value in ArrayList
How to find maximum value in ArrayList
How to find maximum value in ArrayList
How to find maximum value in ArrayList
Listing all even numbers between two numbers
Find Suitable Service Provider, How to Find a Suitable Company for Outsourcing
ModuleNotFoundError: No module named 'largest-frontal-face-detector'
ModuleNotFoundError: No module named 'largest-frontal-face-detector'
ModuleNotFoundError: No module named 'largest-frontal-face-detector'
automorphic numbers
how to write a program in java to print numbers in equalateral triangle
How to find web hosting,find web hosting,right web host

Ads