Advertisement
Spocoman

05. Salary

Sep 21st, 2024 (edited)
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 0.54 KB | None | 0 0
  1. package main
  2.  
  3. import "fmt"
  4.  
  5. func main() {
  6.     var n, salary int
  7.     fmt.Scanln(&n)
  8.     fmt.Scanln(&salary)
  9.    
  10.     var apps string
  11.    
  12.     for i := 0; i < n && salary > 0; i++ {
  13.         fmt.Scanln(&apps)
  14.         if apps == "Facebook" {
  15.             salary -= 150
  16.         } else if apps == "Instagram" {
  17.             salary -= 100
  18.         } else if apps == "Reddit" {
  19.             salary -= 50
  20.         }
  21.     }
  22.  
  23.     if salary <= 0 {
  24.         fmt.Println("You have lost your salary.")
  25.     } else {
  26.         fmt.Println(salary)
  27.     }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement