Showing posts with label Positive and Negative Number Lister Using Golang. Show all posts
Showing posts with label Positive and Negative Number Lister Using Golang. Show all posts

Friday, August 2, 2019

Positive and Negative Number Lister Using Golang

Write a program using a one-dimensional array to ask the user to give a series of positive and negative numbers and then the program will display the list of positive and negative numbers and count the number of occurrence of positive and negative numbers also 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

/* positive_negative.go
   Author   : Mr. Jake Rodriguez Pomperada, MAED-IT
   Date     : August 1, 2019  Thursday  1:44 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 num_val[100] int
var a int
var b int
var c int
var count_positive int
var count_negative int

b = 0
count_positive = 0
count_negative = 0

fmt.Print("\n")
fmt.Print("\t\tPositive and Negative Number Lister")
fmt.Print("\n\n")
fmt.Print("\tHow many items  be process? : ");
fmt.Scanln(&b);
fmt.Print("\n")
for a = 1; a <= b; a++ {
fmt.Printf("\tEnter value in item no. %d : ", a);
fmt.Scanln(&num_val[a]);
}

fmt.Print("\n\n");
fmt.Print("\t===== DISPLAY RESULT =====");
fmt.Print("\n\n");
fmt.Print("\tList of Positive Numbers");
fmt.Print("\n\n");
for c = 1; c <= b; c++ {
if (num_val[c] >= 0) {
fmt.Printf("\t%d ", num_val[c]);
count_positive = count_positive + 1
}
}

fmt.Print("\n\n");
fmt.Print("\tList of Negative Numbers");
fmt.Print("\n\n");
for c = 1; c <= b; c++ {
if (num_val[c] < 75) {
fmt.Printf("\t%d ",num_val[c]);
count_negative = count_negative + 1
}
}

fmt.Print("\n\n");
fmt.Print("\t===== DISPLAY RESULT =====");
fmt.Print("\n\n");
fmt.Printf("\tNumber of Positive Numbers => %d ",count_positive);
fmt.Printf("\n\n");
fmt.Printf("\tNumber of Negative Numbers => %d ",count_negative);
fmt.Print("\n\n")
fmt.Print("\tEnd of Program")
fmt.Print("\n")
}