Advertisement
Spocoman

Movie Profit

Oct 11th, 2024
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 0.65 KB | None | 0 0
  1. package main
  2.  
  3.  import (
  4.     "bufio"
  5.     "fmt"
  6.     "os"
  7.     "strconv"
  8. )
  9.  
  10. func main() {
  11.     scanner := bufio.NewScanner(os.Stdin)
  12.     scanner.Scan()
  13.     movie := scanner.Text()
  14.    
  15.     scanner.Scan()
  16.     days,_ := strconv.Atoi(scanner.Text())
  17.    
  18.     scanner.Scan()
  19.     tickets,_ := strconv.Atoi(scanner.Text())
  20.    
  21.     scanner.Scan()
  22.     ticketPrice,_ := strconv.ParseFloat(scanner.Text(), 64)
  23.  
  24.     scanner.Scan()
  25.     percent,_ := strconv.Atoi(scanner.Text())
  26.    
  27.     price := float64(days) * float64(tickets) * ticketPrice * float64(100 - percent) / 100
  28.  
  29.     fmt.Printf("The profit from the movie %s is %.2f lv.\n", movie, price)
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement