Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class Program
- {
- static void Main()
- {
- int N = int.Parse(Console.ReadLine());
- double woundryPrice = double.Parse(Console.ReadLine());
- int singleToyPrice = int.Parse(Console.ReadLine());
- int numberOfToys = 0;
- int presentInMoney = 0;
- int totalPresentsInMoney = 0;
- for (int i = 1; i <= N; i++)
- {
- if (i%2!=0)
- {
- numberOfToys += 1;
- }
- else if(i%2==0)
- {
- presentInMoney += 10;
- totalPresentsInMoney += presentInMoney-1;
- }
- }
- int MoneyFromToys = numberOfToys * singleToyPrice;
- double moneyCollected = MoneyFromToys + totalPresentsInMoney;
- if (moneyCollected>= woundryPrice)
- {
- Console.WriteLine("Yes! {0:f2}", moneyCollected-woundryPrice);
- }
- else
- {
- Console.WriteLine("No! {0:f2}", woundryPrice-moneyCollected);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement