Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- namespace ConsoleApp6
- {
- class Program
- {
- static void Main()
- {
- double a;
- long n;
- double result = 1;
- string input_1 = Console.ReadLine();
- string input_2 = Console.ReadLine();
- if (!double.TryParse(input_1, out a) | !long.TryParse(input_2, out n))
- {
- Console.WriteLine("wrong");
- }
- else
- {
- double pow = a;
- while (n > 0)
- {
- result = result + a;
- a *= pow;
- n -= 1;
- }
- Console.WriteLine($"{result:0.000}");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement