Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Ex._2
- {
- class Program
- {
- static void Main(string[] args)
- {
- int n = int.Parse(Console.ReadLine());
- double bonus = 0;
- if (n<100)
- {
- // bonus+=5;
- bonus = bonus + 5;
- }
- else if (n > 1000)
- {
- //kod za izpylnenie pri n po-golqmo ot 1000
- bonus = bonus + n * 10.0 / 100;
- }
- else
- {
- //kod za izpylnenie pri n>=100 i n<=1000
- bonus = bonus + n * 20.0 / 100;
- }
- //Вариант 1:
- bool even = n % 2 == 0;
- if (even)
- {
- //bonus+=1;
- bonus = bonus + 1;
- }
- int m = n % 10;
- if (m == 5)
- {
- //bonus+=2;
- bonus = bonus + 2;
- }
- //Вариант 2:
- //if (n % 2 == 0)
- //{
- // bonus += 1;
- //}
- //else if (n % 10 == 5)
- //{
- // bonus += 2;
- //}
- Console.WriteLine(bonus);
- Console.WriteLine(n + bonus);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment