Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace ConsoleApp17
- {
- class Program
- {
- static void Main(string[] args)
- {
- int n = int.Parse(Console.ReadLine());
- double pricewashingmachine = double.Parse(Console.ReadLine());
- int p = int.Parse(Console.ReadLine());
- int totaltoy = 0;
- int totalbirthdaymoney = 0;
- int vsichko = 0;
- for (int i = 1; i <= n; i++ )
- {
- totaltoy = (i / 2)*p;
- }
- for (int i1 = 2; i1 <= n; i1 += 2)
- {
- totalbirthdaymoney += (i1 * 5) - 1;
- }
- vsichko = totaltoy + totalbirthdaymoney;
- if (vsichko >= pricewashingmachine)
- {
- double resto = vsichko - pricewashingmachine;
- Console.WriteLine($"Yes! {resto:f2}");
- }
- else
- {
- double nestiga = vsichko - pricewashingmachine;
- Console.WriteLine($"NO! {nestiga:f2}");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement