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 issue14LiliPodaruk
- {
- class Program
- {
- static void Main(string[] args)
- {
- int n = int.Parse(Console.ReadLine());
- // age of Lili
- double Price = double.Parse(Console.ReadLine());//cena na ureda
- double ToyPrice =double.Parse(Console.ReadLine());//cena na edinichna igrachka
- double gift = 0; //edinichen podaruk suma
- double totalsum = 0; // obshti pari
- double toy=0; //obsto igrachki
- for(int i=1;i<=n;i++)
- {
- // for even year!
- if(i%2==0)
- {
- gift=(((10*i)/2)-1);
- totalsum+=gift;
- }
- else
- {
- toy +=1;
- }
- }
- double Toysum = toy * ToyPrice;
- double Total = Toysum + totalsum;
- if (Total >= Price)
- {
- Console.WriteLine("Yes! {0:f2}",Math.Abs(Total-Price));
- }
- else
- {
- Console.WriteLine("No!{0:f2}",Math.Abs(Price-Total));
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment