Advertisement
Spocoman

Division Without Remainder

Oct 6th, 2024
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 0.49 KB | None | 0 0
  1. package main
  2.  
  3. import "fmt"
  4.  
  5. func main() {
  6.     var n, number, p1, p2, p3 int
  7.     fmt.Scanln(&n)
  8.    
  9.     for i := 1; i <= n; i++ {
  10.         fmt.Scanln(&number)
  11.         if number % 2 == 0 {
  12.             p1++
  13.         }    
  14.         if number % 3 == 0 {
  15.             p2++
  16.         }      
  17.         if number % 4 == 0 {
  18.             p3++
  19.         }
  20.     }
  21.  
  22.     fmt.Printf("%.2f%%\n%.2f%%\n%.2f%%\n", 100 * float64(p1) / float64(n), 100 * float64(p2) / float64(n), 100 * float64(p3) / float64(n))
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement