vojta249

Maturita_11 - faktorial s urcitym poctem opakovani

Mar 27th, 2022 (edited)
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.45 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 číslo pro které chcete vypočítat faktoriál");
  10.             double faktorial = double.Parse(Console.ReadLine());
  11.             double vysledek = faktorial;
  12.             for (int i = 2; i < faktorial; i++)
  13.             {
  14.                 vysledek *= i;
  15.             }
  16.  
  17.             Console.Write("Výsledkem je:");
  18.             Console.WriteLine(vysledek);
  19.             Console.ReadKey();
  20.         }
  21.     }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment