SHARE
TWEET

Untitled

a guest Sep 24th, 2019 78 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.  
  6. namespace ConsoleApp6
  7. {
  8.     class Program
  9.     {
  10.         static void Main()
  11.         {
  12.             double a;
  13.             long n;
  14.             double result = 1;
  15.             string input_1 = Console.ReadLine();
  16.             string input_2 = Console.ReadLine();
  17.             if (!double.TryParse(input_1, out a) | !long.TryParse(input_2, out n))
  18.             {
  19.                 Console.WriteLine("wrong");
  20.             }
  21.             else
  22.             {
  23.                 double pow = a;
  24.                 while (n > 0)
  25.                 {
  26.                     result = result + a;
  27.                     a *= pow;
  28.                     n -= 1;
  29.                 }
  30.                 Console.WriteLine($"{result:0.000}");
  31.             }
  32.         }
  33.     }
  34. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top