using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Average { class Program { static void Main(string[] args) { string a; string b; string c; Console.WriteLine("a&b&c:"); a = Console.ReadLine(); b = Console.ReadLine(); c = Console.ReadLine(); float a1 = Int32.Parse(a); float b1 = Int32.Parse(b); float c1 = Int32.Parse(c); float d = (a1 + b1 + c1) / 3; Console.WriteLine("Result:" + d.ToString()); Console.ReadLine(); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Factorial { class Program { static void Main(string[] args) { string n; Console.WriteLine("n!"); n = Console.ReadLine(); int n1 = Int32.Parse(n); int z = --n1; n1++; while(z!=0) { n1 = n1 * z; z--; } Console.WriteLine("Result:" + n1.ToString()); Console.ReadKey(); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Maximum { class Program { static void Main(string[] args) { Console.WriteLine("n:"); int n = int.Parse(Console.ReadLine()); double[] a = new double[n]; for (int v = 0; v < n; v++) { a[v] = double.Parse(Console.ReadLine()); } double max = a[0]; for (int i = 1; i < n; i++) { if (a[i] > max) max = a[i]; } //double t = z(a[],n); Console.WriteLine(Program.maximum(a, n)); Console.ReadLine(); } static double maximum(double[] a, int n) { double max = a[0]; for (int i = 1; i < n; i++) { if (a[i] > max) max = a[i]; } return max; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Fibonacci { class Program { static void Main(string[] args) { Console.WriteLine("n:"); int n = int.Parse(Console.ReadLine()); int[] z = new int[n]; c(z, n); for (int q = 0; q < n; q++) { Console.WriteLine(z[q]); } Console.ReadLine(); } static void c(int[] a, int n) { a[0] = 1; a[1] = 2; for (int i = 2; i < n; i++) { a[i] = a[i - 1] + a[i - 2]; } } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Least Common Multiple { class Program { static void Main(string[] args) { string a; string b; Console.WriteLine("a&b:"); a = Console.ReadLine(); b = Console.ReadLine(); int a1 = Int32.Parse(a); int b1 = Int32.Parse(b); int x; if (a1 > b1) { x = a1; } else { x = b1; } int c1, c2; c1 = x % a1; c2 = x % b1; while (c1 != 0 || c2 != 0) { x++; c1 = x % a1; c2 = x % b1; } Console.WriteLine("Result : " + x); Console.ReadLine(); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Power { class Program { static void Main(string[] args) { Console.BackgroundColor = ConsoleColor.Cyan; string a; string b; Console.WriteLine("a&b:"); a = Console.ReadLine(); b = Console.ReadLine(); int a1 = Int32.Parse(a); int b1 = Int32.Parse(b); int c = 1; while (b1 != 0) { c = c * a1; b1 = b1 - 1;} Console.WriteLine("result:" + c.ToString()); Console.ReadKey(); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Division { class Program { static void Main(string[] args) { string a; string b; Console.WriteLine("a&b:"); a = Console.ReadLine(); b = Console.ReadLine(); float a1 = float.Parse(a); float b1 = float.Parse(b); float c = a1 / b1; Console.WriteLine("result:" + c.ToString()); Console.ReadKey(); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Multiplication { class Program { static void Main(string[] args) { string a; string b; Console.WriteLine("a&b:"); a = Console.ReadLine(); b = Console.ReadLine(); int a1 = Int32.Parse(a); int b1 = Int32.Parse(b); int c = a1 * b1; Console.WriteLine("result:" + c.ToString()); Console.ReadKey(); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Subtraction { class Program { static void Main(string[] args) { string a; string b; Console.WriteLine("a&b:"); a = Console.ReadLine(); b = Console.ReadLine(); int a1 = Int32.Parse(a); int b1 = Int32.Parse(b); int c = a1 - b1; Console.WriteLine("Result:" + c.ToString()); Console.ReadKey(); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Sum { class Program { static void Main(string[] args) { string a; string b; Console.WriteLine("a&b:"); a = Console.ReadLine(); b = Console.ReadLine(); int a1 = Int32.Parse(a); int b1 = Int32.Parse(b); int c = a1 + b1; Console.WriteLine("Result:" + c.ToString()); Console.ReadLine(); } } }