Skip to content

Instantly share code, notes, and snippets.

@Kanol
Last active August 29, 2015 14:15
Show Gist options
  • Save Kanol/26efa5e5fcabcd450bdb to your computer and use it in GitHub Desktop.
Save Kanol/26efa5e5fcabcd450bdb to your computer and use it in GitHub Desktop.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
Int64 a, b, c, d, e, w;
String u = "";
String g = "";
String h = " рублей";
String j = " рубля";
String k = " рубль";
String t = "Итого:";
String y = "Скидка составила ";
String l = "Вам необходимо заплатить ";
String f = "Спасибо за покупку";
Console.Write("Введите стоимость покупки =>");
a = Convert.ToInt64(Console.ReadLine());
if (a >= 10000)
{
b = a / 10;
c = b * 8;
d = a - c;
e = c % 10;
if ((e == 0) || (e > 4))
g = h;
else
if (e == 1)
g = k;
else
g = j;
w = d % 10;
if ((w == 0) || (w > 4))
u = h;
else
if (w == 1)
u = k;
else
u = j;
Console.WriteLine(t);
Console.Write(y);
Console.Write(d);
Console.WriteLine(u);
Console.Write(l);
Console.Write(c);
Console.WriteLine(g);
Console.WriteLine(f);
Console.ReadLine();
}
else
if (a >= 1000)
{
b = a / 10;
c = b * 9;
d = a - c;
e = c % 10;
if ((e == 0) || (e > 4))
g = h;
else
if (e == 1)
g = k;
else
g = j;
w = d % 10;
if ((w == 0) || (w > 4))
u = h;
else
if (w == 1)
u = k;
else
u = j;
Console.WriteLine(t);
Console.Write(y);
Console.Write(d);
Console.WriteLine(u);
Console.Write(l);
Console.Write(c);
Console.WriteLine(g);
Console.WriteLine(f);
Console.ReadLine();
}
else
{
e = a % 10;
if ((a >= 10) && (a <= 19))
g = h;
else
if ((e == 0) || (e > 4))
g = h;
else
if (e == 1)
g = k;
else
g = j;
Console.WriteLine(t);
Console.Write(y);
Console.Write("0 рублей");
Console.WriteLine(u);
Console.Write(l);
Console.Write(a);
Console.WriteLine(g);
Console.WriteLine(f);
Console.ReadLine();
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment