Advertisement
Guest User

ss

a guest
May 23rd, 2019
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.71 KB | None | 0 0
  1. using System;
  2.  
  3. namespace SpojSUMA
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int prev = 0;
  10.             int act = 0;
  11.             Console.WriteLine("Podaj pierwszą liczbę");
  12.             for (; ;)
  13.             {
  14.                 try
  15.                 {
  16.                     act = Int32.Parse(Console.ReadLine());
  17.                     Console.WriteLine("Wynik: " + (act + prev).ToString() + '\n');
  18.                 }
  19.                 catch(Exception ex)
  20.                 {
  21.                     Console.WriteLine("Nie podano poprawnej liczby!" + '\n');
  22.                 }
  23.                
  24.                 prev += act;
  25.             }
  26.            
  27.  
  28.         }
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement