Friday, August 2, 2019

Highest and Lowest Value Checker Using One-Dimensional Array in Golang


Design a program using a one-dimensional array that will ask the user to give a series of numbers and then the program will check and determine which of the given number is the highest and lowest in terms of numerical value and then display the result on the screen.

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me in the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.

My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.

Here in Bacolod I also accepting computer repair, networking and Arduino Project development at a very affordable price.

My personal website is http://www.jakerpomperada.com



Sample Program Output

Program Listing

/* highest_lowest.go
   Author   : Mr. Jake Rodriguez Pomperada, MAED-IT
   Date     : July 31, 2019  Wednesday  9:22 PM
   Location : Bacolod City, Negros Occidental
   Website  : http://www.jakerpomperada.com
   Emails   : jakerpomperada@gmail.com and jake_pomperada@tup.edu.ph
 */

package main

import "fmt"

func main() {

var  arr[20] int
var a int
b :=0
min :=0
max := 0

fmt.Print("\n")
fmt.Print("\t\tHighest and Lowest Value Checker")
fmt.Print("\n\n")
fmt.Printf("\tHow many items to be process? : ");
fmt.Scanln(&b);
fmt.Print("\n")
for  a = 0; a < b; a++{
fmt.Printf("\tEnter value in item no. %d : ",a+1);
fmt.Scanln(&arr[a]);
}
max = arr[0];
for  a = 0; a < b; a++ {
if (max < arr[a]) {
max = arr[a];
}
}

min = arr[0];
for  a = 0; a < b; a++ {
if min > arr[a] {
min = arr[a]
}
}
fmt.Printf("\n\n");
fmt.Printf("\t===== DISPLAY RESULT =====");
fmt.Printf("\n\n");
fmt.Printf("\tThe Largest Value is %d.",max);
fmt.Printf("\n\n");
fmt.Printf("\tThe Smallest Value is %d.",min);
fmt.Print("\n\n")
fmt.Print("\tEnd of Program")
fmt.Print("\n")
}







No comments:

Post a Comment