Advertisement
Guest User

Untitled

a guest
Dec 19th, 2017
892
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.66 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 numberGenerator
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. int m = int.Parse(Console.ReadLine());
  14. int n = int.Parse(Console.ReadLine());
  15. int l = int.Parse(Console.ReadLine());
  16. int special = int.Parse(Console.ReadLine());
  17. int control = int.Parse(Console.ReadLine());
  18. int numToCheck = 0;
  19. for (int i = m; i >= 1; i--)
  20. {
  21. for (int j = n; j >= 1; j--)
  22. {
  23. for (int k = l; k >= 1; k--)
  24. {
  25. numToCheck = i * 100 + j * 10 + k;
  26. if (numToCheck % 3 ==0)
  27. {
  28. special += 5;
  29. }
  30. else if (numToCheck % 10 == 5)
  31. {
  32. special -= 2;
  33. }
  34. else if (numToCheck % 2 == 0)
  35. {
  36. special *= 2;
  37. }
  38. if (special >=control)
  39. {
  40. Console.WriteLine("Yes! Control number was reached! Current special number is {0}.", special);
  41. return;
  42. }
  43.  
  44. }
  45. }
  46. }
  47. Console.WriteLine("No! {0} is the last reached special number.", special);
  48.  
  49. }
  50. }
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement