Advertisement
AvengersAssemble

Too Impractical

Sep 14th, 2013
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.07 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace TooLong
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             double price = double.Parse(Console.ReadLine());
  14.             int oneAgora = 0, fiveAgora = 0, tenAgora = 0, fifthyAgora = 0, oneShekel = 0, fiveShekel = 0, tenShekel = 0, twentyBill = 0, fifthyBill = 0, hundredBill = 0, twohunderdBill = 0;
  15.                 if (price - 200 >= 0)
  16.                 {
  17.                     twohunderdBill = (int)(price) / 200;
  18.                     price -= 200 * twohunderdBill;
  19.                     Console.WriteLine("{0} 200 shekel bills", twohunderdBill);
  20.                 }
  21.                 if (price - 100 >= 0)
  22.                 {
  23.                     hundredBill = (int)(price / 100);
  24.                     price -= 100 * hundredBill;
  25.                     Console.WriteLine("{0} 100 shekel bills", hundredBill);
  26.                 }
  27.                 if (price - 50 >= 0)
  28.                 {
  29.                     fifthyBill = (int)(price) / 50;
  30.                     price -= 50 * fifthyBill;
  31.                     Console.WriteLine("{0} 50 shekel bills", fifthyBill);
  32.                 }
  33.                 if (price - 20 >= 0)
  34.                 {
  35.                     twentyBill = (int)(price) / 20;
  36.                     price -= 20 * twentyBill;
  37.                     Console.WriteLine("{0} 20 shekels bill", twentyBill);
  38.                 }
  39.                 if (price - 10 >= 0)
  40.                 {
  41.                     tenShekel = (int)(price) / 10;
  42.                     price -= 10 * tenShekel;
  43.                     Console.WriteLine("{0} ten shekels", tenShekel);
  44.                 }
  45.                 if (price - 5 >= 0)
  46.                 {
  47.                     fiveShekel = (int)(price) / 5;
  48.                     price -= 5 * tenShekel;
  49.                    Console.WriteLine("{0} five shekels", fiveShekel);
  50.                 }
  51.                 if (price - 1 >= 0)
  52.                 {
  53.                     oneShekel = (int)(price);
  54.                     price -= oneShekel;
  55.                     Console.WriteLine("{0} one shekels",oneShekel);
  56.                 }
  57.                 if (price - 0.5 >= 0)
  58.                 {
  59.                     fifthyAgora = (int)(price/0.5);
  60.                     price -= 0.5*fifthyAgora;
  61.                     Console.WriteLine("{0} 50 agoras", fifthyAgora);
  62.                 }
  63.             if(price - 0.1 >= 0)
  64.             {
  65.                 tenAgora = (int)(price/0.1);
  66.                 price -= 0.1*tenAgora;
  67.                 Console.WriteLine("{0} ten agoras", tenAgora);
  68.             }
  69.             if(price - 0.05 >= 0)
  70.             {
  71.                 fiveAgora = (int)(price/0.05);
  72.                 price -= 0.05*tenAgora;
  73.                 Console.WriteLine("{0} 5 agoras", fiveAgora);
  74.             }
  75.             if(price - 0.01 >= 0)
  76.             {
  77.                 oneAgora = (int)(price / 0.01);
  78.                 price -= 0.01*tenAgora;
  79.                 Console.WriteLine("{0} 1 agoras", oneAgora);
  80.             }
  81.         }
  82.     }
  83. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement