/*
    Ingus Zemturis
    Gupa: 110
    Compiler: Visual Studio
*/

using System;

public class HelloWorld
{
    public static void Main(string[] args)
    {
        
        
        
        double result = 1;
        Console.WriteLine("ievadi skaitli");
       double num = Convert.ToDouble(Console.ReadLine());
       for (int i = 1; i <= num; i++) {
           result = result * i;
           //Console.WriteLine(i + "_" + result); //salaboja pilnīgi visu manu kodu (atrada vienkāršu pārbaudes kļūdu viena koda daļa)
       }
       Console.WriteLine("skaitla " + num + " faktorials ir: " + result);
       
       
       
       
       
       
       
       
       int[] Numbers = {14, 7, 19, 13, 113, 44, 279, 664, 16, 77, 9661};
       int largestNum = Numbers[0]; //Numbers[0] nozīmē pirmais cipars masīvā
       int smallestNum = Numbers[0];
       int amountOfNumbers = 0;
       double totalValue = Numbers[0];
       //i sākas ar 1 jo 0 (pirmais masīva skaitlis) jav ir ievadīts kā lielākais un mazākais skaitlis
       for (int i = 1; i < Numbers.Length; i++) {
           if (Numbers[i] < smallestNum) {
               smallestNum = Numbers[i];
           }
           if (Numbers[i] > largestNum) {
               largestNum = Numbers[i];
           }
           totalValue = totalValue + Numbers[i];
           //Console.WriteLine(totalValue); // totalValue no int uz double atrisināja problēmu
       }
       amountOfNumbers = Numbers.Length;
       
       Console.WriteLine("lielaakais skaitlis ir " + largestNum + " un mazaakais skaitlis ir " + smallestNum + "\nmasiivaa ir " + amountOfNumbers + " skaitli" + $"\nmasiiva videejais aritmeetiskais ir {totalValue / amountOfNumbers}");
      
       
       
       
       
       
       
       Console.WriteLine("ievadi tekstu");
       string aString = Console.ReadLine();
       string reversal = string.Empty;
       
       for (int i = aString.Length-1; i >= 0; i--) {
           reversal += aString[i];
       }
       Console.WriteLine(reversal);
       
       
       
       
       
       
       
       
       Random rng = new Random();
       int[] numericals = new int[10];
       
       for (int i = 0; i < numericals.Length; i++) {
           numericals[i] = rng.Next(1,101);
           //Console.WriteLine(numericals[i]); //koda darbošanās pārbaude
       }
       int largestVal = numericals[0];
       for (int i = 1; i < numericals.Length; i++) {
           if (numericals[i] > largestVal) {
               largestVal = numericals[i];
           }
       }
       Console.WriteLine("lielaakais skaitlis ir: " + largestVal);
    }
}