if the student has scored 71 points or more, the program should print "passed!" and if the student has scored less than 71 points, it should print "failed!" in go

main.go
package main

import "fmt"

func main() {
    score := 71
   
    if score >= 71 {
        fmt.Println("passed!")
    } else {
        fmt.Println("failed!")
    }
}
166 chars
14 lines

This program uses the if statement in Go to determine if a student has passed or failed based on their score. We compare the score to 71 using the greater than or equal to operator (>=) and print the corresponding result.

related categories

gistlibby LogSnag