Advertisement
Gudini

Homework2_9

Feb 24th, 2024 (edited)
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.83 KB | Source Code | 0 0
  1. using System;
  2.  
  3. namespace Homework2_9
  4. {
  5.     internal class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             Random random = new Random();
  10.  
  11.             int minNumber = 10;
  12.             int maxNumber = 25;
  13.             int numberN = random.Next(minNumber, maxNumber + 1);
  14.             int startRange = 50;
  15.             int endRange = 150;
  16.             int numbersMultiplesN = 0;
  17.  
  18.             for (int i = numberN; i <= endRange; i += numberN)
  19.             {
  20.                 if (i >= startRange)
  21.                 {
  22.                     Console.WriteLine(i);
  23.                     numbersMultiplesN++;
  24.                 }
  25.             }
  26.  
  27.             Console.WriteLine($"Kоличество чисел от {startRange} до {endRange}, которые кратны {numberN}: {numbersMultiplesN}");
  28.         }
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement