Ziomnexpl

silnia

Apr 10th, 2020
207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.90 KB | None | 0 0
  1. using System;
  2. using System.Threading;
  3.  
  4. namespace silnia
  5. {
  6.     class Program
  7.     {
  8.         static void Main(string[] args)
  9.         {
  10.             //silnia
  11.             Console.Clear();
  12.             Console.WriteLine("Program oblicza silnie z ");
  13.             Console.WriteLine();
  14.             Console.Write("podaj n = ");
  15.             int n = 1;
  16.             int i = 1;
  17.             int x = 1;
  18.             n = Convert.ToInt32(Console.ReadLine());
  19.             Console.WriteLine("wpisales n =" + n);
  20.             Console.WriteLine("obliczam");
  21.             n = n + 1;
  22.             for (int j=1;j<10;j++)
  23.             {
  24.                 Console.Write(".");
  25.                 Thread.Sleep(100); //czeka 100 ms
  26.             }
  27.             for (i=1;i<n;i++)
  28.             {
  29.                 x = x * i;
  30.             }
  31.             Console.WriteLine("Wynik = " + x);
  32.             Console.ReadKey();
  33.         }
  34.     }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment