vojta249

Maturita_10 - secist radu cisel

Mar 27th, 2022 (edited)
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.62 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Program
  4. {
  5.     internal class Program
  6.     {
  7.         public static void Main(string[] args)
  8.         {
  9.             Console.WriteLine("Zadejte poćet čísel ");
  10.             int pocet_cisel = int.Parse(Console.ReadLine());
  11.             int[] cisla = new int[pocet_cisel];
  12.             int vysledek = 0;
  13.             int i;
  14.             for (i = 0; i < pocet_cisel; i++)
  15.             {
  16.                 Console.WriteLine("Zadejte číslo");
  17.                 cisla[i] = int.Parse(Console.ReadLine());
  18.             }
  19.  
  20.             for (i = 0; i < pocet_cisel; i++)
  21.             {
  22.                 vysledek = vysledek + cisla[i];
  23.             }
  24.  
  25.             Console.Write("Součet se rovná: ");
  26.             Console.WriteLine(vysledek);
  27.             Console.ReadKey();
  28.         }
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment