Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Runtime.ExceptionServices;
- namespace vegtelen_ciklus
- {
- class Program
- {
- static void Main(string[] args)
- {
- int n, i, faktorialis;
- while (true)
- {
- Console.Write("Írj be egy egész számot: ");
- n = int.Parse(Console.ReadLine());
- if (n < 0) break;
- faktorialis = 1;
- for(i = 1; i <=n; i++)
- {
- faktorialis *= i;
- }
- Console.WriteLine("Az {0}! = {1}", i - 1, faktorialis);
- }
- Console.WriteLine("Vége");
- Console.ReadLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement