Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace pets
- {
- class Program
- {
- static void Main(string[] args)
- {
- //input
- double days = double.Parse(Console.ReadLine());
- double kgFood = double.Parse(Console.ReadLine());
- double dogfood =double.Parse(Console.ReadLine());
- double catFood = double.Parse(Console.ReadLine());
- double turtleFood = double.Parse(Console.ReadLine());
- //logic
- double turtlefoodkg= turtleFood / 1000;
- double dogfoodTotal = days * dogfood;
- double catfoodtotal = days * catFood;
- double turtlefoodtotal = days* turtlefoodkg ;
- double totalfood = dogfoodTotal + catfoodtotal + turtlefoodtotal;
- double leftfood = Math.Abs(kgFood - totalfood);
- if(totalfood<kgFood)
- {
- Console.WriteLine("{0} kilos of food left.",Math.Floor(leftfood));
- }
- else if(totalfood>kgFood)
- {
- Console.WriteLine("{0} more kilos of food are needed.}",Math.Ceiling(leftfood));
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment