Advertisement
rukvir

HW 2_10_1

May 18th, 2022
478
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace HomeWorck_2_10_1
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int number, result = 1, counterDegree = 0;
  14.             Random rndNumber = new Random();
  15.  
  16.             Console.WriteLine("Число для расчетов");
  17.             number = rndNumber.Next(0,100);
  18.             Console.WriteLine(number);
  19.  
  20.             while (number >= result) {
  21.                 counterDegree++;
  22.                 result *= 2;
  23.             }
  24.             Console.WriteLine($"Число: {result} Степень: {counterDegree}");
  25.  
  26.             Console.ReadKey();
  27.         }
  28.     }
  29. }
Advertisement
RAW Paste Data Copied
Advertisement