Advertisement
Guest User

asdasdas

a guest
Oct 23rd, 2017
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.90 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 ConsoleApp1
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             haha:
  14.             Console.WriteLine("Give number items");
  15.             Console.WriteLine();
  16.             int n = int.Parse(Console.ReadLine());
  17.             Console.WriteLine();
  18.             if (n < 1) goto haha;
  19.             if (n == 1)
  20.             {
  21.                 Console.WriteLine("Give price of item number 1");
  22.                 Console.WriteLine();
  23.                 double first = double.Parse(Console.ReadLine());
  24.                 Console.WriteLine();
  25.                 Console.WriteLine("{0} ---> {1}", first, first);
  26.             }
  27.             else Print(n);
  28.             Console.WriteLine();
  29.             Console.WriteLine();
  30.             Console.WriteLine();
  31.             goto haha;
  32.  
  33.         }
  34.         static void Print(int n)
  35.         {
  36.             if (n == 2) IfTwo();
  37.             else IfMore(n);
  38.         }
  39.         static void IfTwo()
  40.         {
  41.             Console.WriteLine("Give price of item number 1");
  42.             Console.WriteLine();
  43.             double first = double.Parse(Console.ReadLine());
  44.             Console.WriteLine();
  45.             Console.WriteLine("{0} ---> {1}", first, first);
  46.             Console.WriteLine();
  47.             Console.WriteLine("Give price of item number 2");
  48.             Console.WriteLine();
  49.             double second = double.Parse(Console.ReadLine());
  50.             double sum = Math.Floor(second - (second * 0.2));
  51.             Console.WriteLine();
  52.             Console.WriteLine("{0} - 20% ---> {1:F0}",second, sum);
  53.             Console.WriteLine();
  54.         }
  55.         static void IfMore(int n)
  56.         {
  57.             Console.WriteLine("Give price of item number 1");
  58.             Console.WriteLine();
  59.             double first = double.Parse(Console.ReadLine());
  60.             Console.WriteLine();
  61.             Console.WriteLine("{0} ---> {1}", first, first);
  62.             Console.WriteLine();
  63.             Console.WriteLine("Give price of item number 2");
  64.             Console.WriteLine();
  65.             double second = double.Parse(Console.ReadLine());
  66.             double sum = Math.Floor(second - (second * 0.2));
  67.             Console.WriteLine();
  68.             Console.WriteLine("{0} - 20% ---> {1:F0}", second, sum);
  69.             Console.WriteLine();
  70.             for (int i = 3; i <= n; i++)
  71.             {
  72.                 sum = 0;
  73.                 Console.WriteLine("Give price of item number {0}",i);
  74.                 Console.WriteLine();
  75.                 double other = double.Parse(Console.ReadLine());
  76.                 sum = Math.Floor(other - (other * 0.3));
  77.                 Console.WriteLine();
  78.                 Console.WriteLine("{0} - 30% ---> {1:F0}", other, sum);
  79.                 Console.WriteLine();
  80.             }
  81.         }
  82.     }
  83. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement