Created
April 5, 2020 14:46
-
-
Save twr14152/1da4349c69e8af60245a539c9513ffdc to your computer and use it in GitHub Desktop.
Pushup Counter workout routine
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
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