Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace Степень_двойки
- {
- internal class Program
- {
- static void Main(string[] args)
- {
- int minRandomNumber = 1;
- int maxRandomNumber = 100;
- int mainNumber = 2;
- Random random = new Random();
- int randomNumber = random.Next(minRandomNumber, maxRandomNumber+1);
- int numberDegree = 0;
- int result = 1;
- while (result <= randomNumber)
- {
- numberDegree++;
- result *= mainNumber;
- }
- Console.WriteLine($"Случайное число от {minRandomNumber} до {maxRandomNumber}: {randomNumber}");
- Console.WriteLine($"Степень числа {mainNumber}: {numberDegree}");
- Console.WriteLine($"{mainNumber} ^ {numberDegree} = {result}");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement