Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ThreeDigitNaturalNumbers
- {
- class Program
- {
- static void Main(string[] args)
- {
- int numberN;
- int minNumberN = 1;
- int maxNumberN = 27;
- int firstFourDigitNumber = 1000;
- Random random = new Random();
- numberN = random.Next(minNumberN, maxNumberN + 1);
- int countThreeDigitNumber = 0;
- for (int i = numberN; i < firstFourDigitNumber; i += numberN)
- {
- if (i < firstFourDigitNumber)
- countThreeDigitNumber++;
- }
- Console.Write($"Количество трехзначных натуральных чисел, которые кратны {numberN}: {countThreeDigitNumber}");
- Console.ReadKey();
- }
- }
- }
Add Comment
Please, Sign In to add comment