Infiniti_Inter

Практику 5(III) 8

Oct 26th, 2019
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.54 KB | None | 0 0
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6.  
  7. namespace mainSolution
  8. {
  9.    
  10.  
  11.    
  12.  
  13.     static class Program
  14.     {
  15.  
  16.         static int autoSum(int n)
  17.         {
  18.            
  19.             return ((n + n * n) / 2);
  20.         }
  21.  
  22.         static void Main(string[] args)
  23.         {
  24.             int m = Int32.Parse(Console.ReadLine());
  25.             int k = Int32.Parse(Console.ReadLine());
  26.             Console.WriteLine(autoSum(m) + autoSum(2 * k));
  27.         }
  28.  
  29.     }
  30. }
Add Comment
Please, Sign In to add comment