Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

maximum number from random number in java

Scanner s = new Scanner(System.in);
System.out.println("Type a number");
int n = s.nextInt();
int start = 0;
int largest = 0;
int occurrence = 0;

while(n > start){
    int number = (int)(Math.random()*100);
    if(number > largest){
        largest = number;


    }
    n--;
    System.out.print(number+" ");
}

System.out.println("max is "+largest);
System.out.println("Occurrence is "+occurrence);
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #maximum #number #random #number #java
ADD COMMENT
Topic
Name
2+1 =