Advertisement
BloodMoonYTC

faktorialis

Oct 24th, 2021
777
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.56 KB | None | 0 0
  1. using System;
  2.  
  3. namespace faktorialis_feladat
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             Console.WriteLine("Kólity Kristóf");
  10.             Console.Write("Irj be egy természetes számot: ");
  11.             int n = int.Parse(Console.ReadLine());
  12.  
  13.             int faktorialis = 1;
  14.  
  15.             for (int i = 1; i <= n; i++)
  16.             {
  17.                 faktorialis *= i;
  18.             }
  19.             Console.WriteLine(n + "! faktorialis erteke = " + faktorialis);
  20.             Console.ReadLine();
  21.         }
  22.     }
  23. }
  24.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement