Advertisement
BERKYT

go lesson 3

Jan 25th, 2025
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 0.58 KB | None | 0 0
  1. package main
  2.  
  3. import (
  4.     "fmt"
  5. )
  6.  
  7. func main() {
  8.     const PASSING_SCORE int = 60
  9.     scores := [5]int{85, 55, 70, 40, 90}
  10.     passingCount := 0
  11.  
  12.     for _, score := range scores {
  13.         if score >= PASSING_SCORE {
  14.             passingCount++
  15.             fmt.Printf("Студент сдал с оценкой: %d\n", score)
  16.         } else {
  17.             fmt.Printf("Студент не сдал с оценкой: %d\n", score)
  18.         }
  19.     }
  20.  
  21.     fmt.Printf("Общее количество студентов, которые сдали экзамен: %d\n", passingCount)
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement