Advertisement
Vapio

task7

Jul 27th, 2022 (edited)
749
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.86 KB | None | 0 0
  1. using System;
  2.  
  3. public class Program
  4. {
  5.     public static void Main(string[] args)
  6.     {
  7.         Random random = new Random();
  8.  
  9.         int numberRandomStart = 1;
  10.         int numberRandomEnd = 27;
  11.  
  12.         int numberRandom = random.Next(numberRandomStart, numberRandomEnd);
  13.  
  14.         double numberStart = 100;
  15.         double numberEnd = 999;
  16.  
  17.         int numberCount = 0;
  18.  
  19.         for (int numberTotal = numberRandom; numberTotal <= numberEnd; numberTotal += numberRandom)
  20.             if (numberTotal >= numberStart)
  21.                 ++numberCount;
  22.  
  23.         Console.WriteLine("Start number random is : " + numberRandomStart);
  24.         Console.WriteLine("End number random is : " + numberRandomEnd);
  25.         Console.WriteLine("Random number is : " + numberRandom);
  26.         Console.WriteLine("Amount of multiples of three-digit numbers  : " + numberCount);
  27.     }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement