Advertisement
vovanhik_24

#16

Aug 23rd, 2023 (edited)
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.67 KB | None | 0 0
  1.             int minRandomNumber = 1;
  2.             int maxRandomNuber = 28;
  3.             int result = 0;
  4.             int minNumber = 100;
  5.             int maxNumber = 1000;
  6.  
  7.             Random random = new Random();
  8.             int number = random.Next(minRandomNumber, maxRandomNuber);
  9.  
  10.             for (int i = 0; i <= maxNumber-1; i += number)
  11.             {
  12.                 if (i >= minNumber)
  13.                 {
  14.                     Console.WriteLine($"\nЧисло: {i}");
  15.                     result++;
  16.                 }
  17.             }
  18.  
  19.             Console.WriteLine($"\nКоличество трехзначных натуральных чисел: {result}\nN = {number}");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement