Advertisement
Guest User

Untitled

a guest
Apr 5th, 2020
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.16 KB | None | 0 0
  1. using System;
  2.  
  3. namespace ConsoleApp17
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int n = int.Parse(Console.ReadLine());
  10.             double pricewashingmachine = double.Parse(Console.ReadLine());
  11.             int p = int.Parse(Console.ReadLine());
  12.  
  13.             int totaltoy = 0;
  14.             int totalbirthdaymoney = 0;
  15.             int vsichko = 0;
  16.  
  17.  
  18.  
  19.             for (int i = 1; i <= n; i++ )
  20.             {
  21.  
  22.                 totaltoy = (i / 2)*p;
  23.  
  24.  
  25.             }
  26.             for (int i1 = 2; i1 <= n; i1 += 2)
  27.             {
  28.                 totalbirthdaymoney += (i1 * 5) - 1;
  29.  
  30.  
  31.             }
  32.             vsichko = totaltoy + totalbirthdaymoney;
  33.  
  34.             if (vsichko >= pricewashingmachine)
  35.             {
  36.                
  37.                 double resto = vsichko - pricewashingmachine;
  38.                 Console.WriteLine($"Yes! {resto:f2}");
  39.  
  40.  
  41.  
  42.  
  43.             }
  44.             else
  45.             {
  46.  
  47.                
  48.                 double nestiga = vsichko - pricewashingmachine;
  49.                 Console.WriteLine($"NO! {nestiga:f2}");
  50.  
  51.  
  52.             }
  53.            
  54.  
  55.         }
  56.     }
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement