If you have some questions please send me an email at jakerpomperada@yahoo.com and jakerpomperada@gmail.com.
People here in the Philippines who wish to contact me can reach me at my mobile number 09173084360.
Program Listing
import java.util.Scanner;
public class high_low{
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
char a;
do
{
System.out.print("\n");
System.out.println("==============================================");
System.out.println("|| << HIGHEST AND LOWEST NUMBER FINDER >> ||");
System.out.println("==============================================");
System.out.print("\n");
System.out.print("How Many Items To Be Process :=> ? ");
int num = input.nextInt();
int numbers[] = new int[num];
int largest_number = numbers[0];
int smallest_number = numbers[0]+1;
for(int i=0; i< numbers.length; i++)
{
int b=i+1 ;
System.out.print("Enter Value in Item No. "+b + " : ");
numbers[i] = input.nextInt();
if(numbers[i] > largest_number)
largest_number = numbers[i];
else if (numbers[i] < smallest_number)
smallest_number = numbers[i];
}
System.out.println("\n\n");
System.out.println("THE LARGEST NUMBER IS :=> " + largest_number);
System.out.println("THE SMALLEST NUMBER IS :=> " + smallest_number);
System.out.println("\n\n");
System.out.print("Do you Want To Continue (Y/N) :=> ");
a=input.next().charAt(0);
} while(a=='Y'|| a=='y');
System.out.println("\n");
System.out.println("\t ===== END OF PROGRAM ======");
System.out.println("\n");
}
}
No comments:
Post a Comment