The program is an illustration of loops
<h3>What are loops?</h3>
Loops are program statements that are used to execute repeated statements
<h3>The java program</h3>
The program, written in Java where comments are used to explain each line is as follows:
import java.util.*;
public class Main{
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int num;
//Get input from the user
num = input.nextInt();
//Initialize the largest to the first input
int maxn = num;
//This loop is repeated until a negative input is recorded
while (num >=0){
//If the current input is greater than the previous largest
if (num>maxn){
//Set largest to the current input
maxn = num; }
//Get another input from the user
num = input.nextInt();
}
//Print the largest
System.out.print("Largest: "+maxn);
}
}
Read more about loops at:
brainly.com/question/14284157