Q:

Write a java program that will read a specific number of integers n and then print the minimum number. Name your class Minimum

0

Write a java program that will read a specific number of integers n and 

then print the minimum number.

Name your class Minimum.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

import java.util.Scanner;
public class Main
{
	public static void main(String[] args) {
		Scanner input=new Scanner(System.in);
		System.out.println("please enter n:");
		int n=input.nextInt();

		    System.out.println("enter number: ");
		    int minimum=input.nextInt();
		    n--;
		    int number;
		    while(n>0)
		    {
		    System.out.println("enter number: ");
		    number=input.nextInt();
		    if(number<minimum)
		    minimum=number;
		    n--;
		        
		    }
		    System.out.println("the minimum number is : "+minimum);		
	}
}

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Write a java program that will read a specific num... >>
<< Write a Java program that will read an unspecified...