Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class ProjectLoop {
- public static void main(String[]args){
- String cont ="";
- int[] anArray;
- anArray = new int[3];
- Scanner input = new Scanner(System.in);
- while (true) {
- // anArray[0] = number;
- System.out.print("Enter number: ");
- anArray[0] = input.nextInt();
- System.out.print("Enter number: ");
- anArray[1] = input.nextInt();
- System.out.print("Enter number: ");
- anArray[2] = input.nextInt();
- evaluate (anArray);
- input.nextLine();
- cont = input.nextLine();
- if (cont.equals("q"));
- break;
- }
- }
- public static void evaluate(int[] ar) {
- int smallest = ar[0];
- for(int i = 0; i <ar.length;i++) {
- if(ar[i] < smallest) {
- smallest =ar[i];
- }
- }
- System.out.println("The smllest is " +smallest);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement