Advertisement
AlexRaynor

2.3 ToTheMoon

Sep 22nd, 2019
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.55 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace ConsoleApp18
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.  
  14.             float paperWidth = 1f;
  15.             long totalDistance = 300000000000;
  16.             int foldPapers = 0;
  17.  
  18.             while (paperWidth < totalDistance)
  19.             {
  20.                 paperWidth *= 2;
  21.                 ++foldPapers;
  22.             }
  23.  
  24.             Console.WriteLine(foldPapers);
  25.  
  26.         }
  27.     }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement