Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace homeWorkDegreeOfTwo
- {
- internal class Program
- {
- static void Main(string[] args)
- {
- Random random = new Random();
- int minValueNumber = 0;
- int maxValueNumber = 1000;
- int number = random.Next(minValueNumber, maxValueNumber+1);
- int resultNumber = 1;
- int countDegree = 0;
- int degree = 2;
- Console.WriteLine($"Сгенерированное число: {number}");
- while (resultNumber <= number)
- {
- resultNumber *= degree;
- countDegree++;
- }
- Console.WriteLine(
- $"Минимальная степень 2, превосходящая сгенерированное число {countDegree}, равна {resultNumber}");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement