Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Homework2_10
- {
- internal class Program
- {
- static void Main(string[] args)
- {
- Random random = new Random();
- int minNumberN = 1;
- int maxNumberN = 100;
- int numberN = random.Next(minNumberN, maxNumberN + 1);
- int degree = 1;
- int number = 2;
- int numberInDegree = 2;
- bool raisingNumberToPower = true;
- while (raisingNumberToPower)
- {
- if(numberInDegree < numberN)
- {
- numberInDegree *= number;
- degree++;
- }
- else
- {
- Console.WriteLine($"Число:{numberN} степень:{degree} число 2 в найденной степени:{numberInDegree}");
- raisingNumberToPower = false;
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement