Advertisement
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 ConsoleApp1
- {
- class Program
- {
- static void Main(string[] args)
- {
- haha:
- Console.WriteLine("Give number items");
- Console.WriteLine();
- int n = int.Parse(Console.ReadLine());
- Console.WriteLine();
- if (n < 1) goto haha;
- if (n == 1)
- {
- Console.WriteLine("Give price of item number 1");
- Console.WriteLine();
- double first = double.Parse(Console.ReadLine());
- Console.WriteLine();
- Console.WriteLine("{0} ---> {1}", first, first);
- }
- else Print(n);
- Console.WriteLine();
- Console.WriteLine();
- Console.WriteLine();
- goto haha;
- }
- static void Print(int n)
- {
- if (n == 2) IfTwo();
- else IfMore(n);
- }
- static void IfTwo()
- {
- Console.WriteLine("Give price of item number 1");
- Console.WriteLine();
- double first = double.Parse(Console.ReadLine());
- Console.WriteLine();
- Console.WriteLine("{0} ---> {1}", first, first);
- Console.WriteLine();
- Console.WriteLine("Give price of item number 2");
- Console.WriteLine();
- double second = double.Parse(Console.ReadLine());
- double sum = Math.Floor(second - (second * 0.2));
- Console.WriteLine();
- Console.WriteLine("{0} - 20% ---> {1:F0}",second, sum);
- Console.WriteLine();
- }
- static void IfMore(int n)
- {
- Console.WriteLine("Give price of item number 1");
- Console.WriteLine();
- double first = double.Parse(Console.ReadLine());
- Console.WriteLine();
- Console.WriteLine("{0} ---> {1}", first, first);
- Console.WriteLine();
- Console.WriteLine("Give price of item number 2");
- Console.WriteLine();
- double second = double.Parse(Console.ReadLine());
- double sum = Math.Floor(second - (second * 0.2));
- Console.WriteLine();
- Console.WriteLine("{0} - 20% ---> {1:F0}", second, sum);
- Console.WriteLine();
- for (int i = 3; i <= n; i++)
- {
- sum = 0;
- Console.WriteLine("Give price of item number {0}",i);
- Console.WriteLine();
- double other = double.Parse(Console.ReadLine());
- sum = Math.Floor(other - (other * 0.3));
- Console.WriteLine();
- Console.WriteLine("{0} - 30% ---> {1:F0}", other, sum);
- Console.WriteLine();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement