Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


mahamat ali
exercise.
1 Answer(s)      3 years and 8 months ago
Posted in : Java Beginners


write a program that reads 10 numbers fin the largest number and count the occurrence of the largest number from declared array assume you assigned 4,6,3,2,5,6,6,1 and 6.


Advertisement
View Answers

May 17, 2011 at 4:32 PM


import java.util.*;
class  FindLargest{
    public static void main(String[] args){
        int max = Integer.MIN_VALUE;
        System.out.println("Enter 10 numbers:");
        Scanner input=new Scanner(System.in);
        int array[]=new int[10];
        int count=0;
        for(int i=0;i<array.length;i++){
            array[i]=input.nextInt();
            if (array[i] > max) {
                max = array[i];
               }
         }
         for(int i=0;i<array.length;i++){
             if(array[i]==max){
                 count++;
             }
         }
        System.out.println("Largest Number is "+max+" which occurs "+count+" times");
    }
}


Related Tutorials/Questions & Answers:
exercise.
exercise.  write a program that reads 10 numbers fin the largest number and count the occurrence of the largest number from declared array assume you assigned 4,6,3,2,5,6,6,1 and 6
Exercise 17
Exercise 17  Character Counter Write a program which takes an input string and determines the number of vowels, consonants, digits, and special characters (i.e., all other nonalphanumeric characters) in the string
Advertisements
Exercise 19
Exercise 19  Duplicates 2 Write a Java program that takes as input a string, determines how many characters has duplicates, and prints out each of those values, along with the count for each. Ignore spaces in the counting
Exercise 16
Exercise 16  Number Format Large numbers are typically written with a comma in between every group of three digits (e.g., 12,345,678,765,432 or -32,768). Write a Java program that accepts as input an integer and outputs
Exercise 18
Exercise 18  Duplicates1 Write a Java program that determines how many values in a 100-element array has duplicates, and prints out each of those values, along with the count for each. Use the code given below to fill up your
Exercise 20
Exercise 20  Common Letters Write a program that takes two words as input and finds any common letters that they have. For example, the words ‚??computer‚?? and ‚??program‚?? have the letters ‚??o‚??, ‚??m‚??, ‚??p‚??, and ‚??r‚
Asking for exercise - Java Beginners
Asking for exercise  Can you send me a small exercise question -a prograsm for collections in java?  Hi Friend, Please visit the following link: http://www.roseindia.net/javacodeexamples/index.shtml Thanks
An exercise using (SRS) as a blue print for Abstraction and Modeling in a one page answer. Was this example correct?
An exercise using (SRS) as a blue print for Abstraction and Modeling in a one page answer. Was this example correct?  The software tool to help automate the process of producing a blueprint for problems with a television
c++ new, delete, string class
contained in string1: Exercise 1 Good morning Create a new string named string2... the following heading and the data contained in string2: Exercise 2 Good morning...: Exercise 3 20 Create an empty string named string4. Copy string3 into string4
Disadvantages Of Obesity
Lack of exercise - People are eating a lot, but not doing any or enough exercise. Every one should do exercise regularly. You should perform Yoga Exercise to control your weight. Hereditary Metabolic disorders
Java code for set...!!!
Java code for set...!!!  Create 2 classes in same package Product.java productId, name, price ProductImpl.java create a set in this and try to add objects of product. You should write this exercise such that it should
Led Track Lighting
; Industrial, Exercise Fitness Equipment & much more
Airbrush Tattoos
Airbrush Tattoos  **Deleted by admin **, we are a direct importer and vendor of small business equipment & home goods. Buy at wholesale prices : Aquarium Supplies, Bicycle Motor, Business & Industrial, Exercise Fitness
Arrays
Arrays   Hi I need help with the following exercises. Exercise 1: Write a Java application in which the user is prompted for the total number... of all the values as well. Exercise 2: Write a Java application in which you
Implementing ArrayList's functionalities into arrays - Java Beginners
Implementing ArrayList's functionalities into arrays  Hi guys, i'm trying to solve an exercise were is asked to write a program that manages the grades of a list of students (given by the exercise) for one single exam; The list
Which java can i download?
Which java can i download?  Hello, i'm a beginner on java. Which java can i download for to exercise with my codes? Thanks in advance.   nobody.   And i download Eclipse java. But when i want to install
Java Objectives Question
Java Objectives Question  Exercise 1: Create a file by using any word... as FileStatistics.java. Exercise 2: Create a file that contains your favorite movie quote. Use... Exercise 3: Write an application using the FileInputStream that opens a file
wrapper class concept
of this exercise, initialize a couple of String objects that contain an integer
\wrapper
\wrapper  Hands on Exercise on Wrapper Class: Write a Java code that converts integer to Integer converts Integer to String converts String to integer converts int to String converts String to Integer converts Integer
\wrapper
\wrapper  Hands on Exercise on Wrapper Class: Write a Java code that converts integer to Integer converts Integer to String converts String to integer converts int to String converts String to Integer converts Integer
\wrapper
\wrapper  Hands on Exercise on Wrapper Class: Write a Java code that converts integer to Integer converts Integer to String converts String to integer converts int to String converts String to Integer converts Integer
discount system.
write a test program to exercise all the classes
Weight Loss Surgery Side Effects
. The best way is regular exercise, healthy diet and regular health check ups. On the contrary, unhealthy diet, irregular timing of intake of food, no exercise... involves exercise and diet check that can keep you healthy for a long time
Java eft transaction
of this exercise, a customer may have one or more accounts but will only ever have one... number and account type. 5.1 Exercise 1 Implement the findLinkedAccounts... accounts that are linked to the customer. 5.2 Exercise 2 Implement the authorize
USE ARRAY TO FIND THE LARGEST NUMBER AND OCCURRENCE
USE ARRAY TO FIND THE LARGEST NUMBER AND OCCURRENCE  i have some exercise from my lecturer and I still can't understand about ARRAY. here it is: write a program that reads 10 numbers from the keyboard. find the largest number
XML in java - XML
argument.Then modify the program resulting from the this exercise so that it will accept
Inheretance and polymorphism - Java Beginners
. merry christmas and happy new year to you! Exercise 1.) A point the x-y plane.... ------------------------------------------------------------------------------ Exercise 2.) Every... in Programming Exercise 1, you must derive the class Circle from the class
the discount system.
, for a visit. also write a test program to exercise all the classes
the discount system.
, for a visit. also write a test program to exercise all the classes
 

 

 

DMCA.com