Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace NumberGenerator
- {
- internal class Program
- {
- static void Main(string[] args)
- {
- int m = int.Parse(Console.ReadLine());
- int n = int.Parse(Console.ReadLine());
- int l = int.Parse(Console.ReadLine());
- int special = int.Parse(Console.ReadLine());
- int control = int.Parse(Console.ReadLine());
- for (int i = m; i > 0; i--)
- {
- for (int j = n; j > 0; j--)
- {
- for (int k = l; k > 0; k--)
- {
- int num = i * 100 + j * 10 + k;
- if (num % 3 == 0)
- {
- special += 5;
- }
- else if (num % 5 == 0)
- {
- special -= 2;
- }
- else if (num % 2 == 0)
- {
- special *= 2;
- }
- if (special >= control)
- {
- Console.WriteLine($"Yes! Control number was reached! Current special number is {special}.");
- Environment.Exit(0);
- }
- }
- }
- }
- Console.WriteLine($"No! {special} is the last reached special number.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement