SHARE
TWEET

Untitled

a guest Oct 22nd, 2019 75 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace Scitani_s_vypisem
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             Console.WriteLine("Zadejte počet čísel na sečtení: ");
  14.             int pocet = int.Parse(Console.ReadLine());
  15.  
  16.             int[] cisla = new int[pocet];
  17.             for (int i = 0; i < pocet; i++)
  18.             {
  19.                 Console.Write("Zadejte {0}. číslo: ", i + 1);
  20.                 cisla[i] = int.Parse(Console.ReadLine());
  21.             }
  22.  
  23.             for (int i = 0; i < pocet; i++)
  24.                 if (i+1 == pocet)
  25.                 {
  26.                     Console.Write("{0} = {1} ", cisla[i], cisla.Sum());
  27.                 }
  28.                 else
  29.                 {
  30.                     Console.Write("{0} + ", cisla[i]);
  31.                 }
  32.  
  33.  
  34.  
  35.  
  36.  
  37.             Console.ReadKey();
  38.         }
  39.     }
  40. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top