Advertisement
Guest User

Untitled

a guest
Dec 18th, 2014
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. internal static class Gg
  2. {
  3. /// <summary>
  4. /// вычисляя сумму Sn как сумму элементов a1 + a[2] + a[3] + ... + a[n]
  5. /// </summary>
  6. public static void Govno()
  7. {
  8. var a1 = 0;
  9. Console.Write("Введите n: ");
  10. var n = int.Parse(Console.ReadLine());
  11. for (var i = 0; i < n; i++)
  12. {
  13. Console.Write("Введите a{0}: ", i + 1);
  14. a1 += int.Parse(Console.ReadLine());
  15. }
  16. Console.Write("Введите d: ");
  17. var d = int.Parse(Console.ReadLine());
  18.  
  19. var an = a1 + d*(n - 1);
  20. double Sn = a1;
  21.  
  22. Console.WriteLine("Sn={0}", Sn);
  23. Console.ReadKey();
  24. }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement