Skip to content

Instantly share code, notes, and snippets.

@twr14152
Created April 5, 2020 14:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save twr14152/1da4349c69e8af60245a539c9513ffdc to your computer and use it in GitHub Desktop.
Save twr14152/1da4349c69e8af60245a539c9513ffdc to your computer and use it in GitHub Desktop.
Pushup Counter workout routine
/*
Specify a number of pushups you want to do in a set.
Every 30 secs do another set - 1 rep. Repeat until you reach 0.
This program will calculate how many pushups you do in total
*/
package main
import (
"fmt"
"os"
"strconv"
)
var sets int
var reps int
func pushupCountDn(sets int) {
for i := sets; i > 0; i-- {
//fmt.Println("value of i: ", i)
reps += i
//fmt.Println("reps = ", reps)
}
fmt.Println(reps)
}
func main() {
num := os.Args[1:]
pushups := num[0]
number, _ := strconv.Atoi(pushups)
sets := number
pushupCountDn(sets)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment