Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.
Trending News
any one know programing java programing?
i got a java programing book and in the book has one project that i interesting but i dont know how to do it . so does anyone know how to do this poject ? and please explian some code that use in this project for me cause i want to know how it work? thank so this is the project
First:
- prompt the user for a series of numbers to determine the largest value entered.
- before the program terminates, display the largest value
4 Answers
- 1 decade agoFavorite Answer
import java.util.Scanner;
/**
*
* @author Jeric Bryle Sy Dy
*/
public class Main {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
int n, highest = Integer.MIN_VALUE;
System.out.println("enter the how many numbers to be entered:");
n = s.nextInt();
for (int i=0; i<n; i++) {
int input = s.nextInt();
highest = Math.max(highest, input);
}
System.out.println("The highest is " + highest);
}
}
- Anonymous5 years ago
download eclipse or BlueJ if you want to run in command prompt then you must change the location to the folder where your programs is just write cd and then path of folder if error comes which say cannot find java compiler then you may have to tell the compiler or just copy your programs into the bin folder of JDK
- 1 decade ago
/* the logic is initially the series of numbers are taken into an array 'a' and the variable 'big; is intialised to zero. using a for loop elements in array 'a' are compare with variable 'big' if any number greater than big is found then than number is assigned to big by the completion of for loop we will have greatest number in the variable 'big' */
import java.io.*;
class Largest
{
public static void main(String args[]) throws IOException
{
DataInputStream d=new DataInputStream(System.in);
System.out.println("enter the value for n");
int n=Integer.parseInt(d.readLine( ) );
int a[]=new int[n];int big=0;
System.out.println("enter "+n+"values");
for(int i=0;i<n;i++)
a[i]=Integer.parseInt(d.readLine( ) );
for(int i=0;i<n;i++)
{
if(a[i]>big)
big=a[i];
}
System.out.println("the largest number is "+big);
}
- 1 decade ago
oh yes, I know java programming, do you have any java project to do?
Source(s): aadhunik