Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Caaaa
- {
- class Program
- {
- static int Rev(int k) //method 1
- {
- int k1 = 0;
- while (k!=0)
- {
- k1 = k1 * 10 + k % 10;
- k = k / 10;
- }
- return k1;
- }
- static void Avg() //2
- {
- Console.Write("br = ");
- int br = int.Parse(Console.ReadLine());
- int sum = 0;
- int x;
- for (int i = 0; i < br; i++)
- {
- Console.Write("x -> ");
- x = int.Parse(Console.ReadLine());
- sum = sum + x;
- }
- Console.WriteLine("avg = " + Math.Round(1.0 * sum / br,2));
- }
- static double Eq() //3
- {
- Console.Write("a = "); double a = double.Parse(Console.ReadLine());
- while (a == 0)
- {
- Console.Write("a = "); a = double.Parse(Console.ReadLine());
- }
- Console.Write("b = "); double b = double.Parse(Console.ReadLine());
- return Math.Round(-b / a,2);
- }
- static void Main(string[] args)
- {
- int ch;
- int K;
- double x;
- do
- {
- Console.WriteLine("1 - reverse ");
- Console.WriteLine("2 - avg ");
- Console.WriteLine("3 - eq ");
- Console.WriteLine("4 - finish ");
- Console.Write("your choice : ");
- ch = int.Parse(Console.ReadLine());
- switch (ch)
- {
- case 1: Console.Write("K = "); K = int.Parse(Console.ReadLine());
- Console.WriteLine(" k1 = " + Rev(K)); break;
- case 2: Avg(); break;
- case 3: x = Eq(); Console.WriteLine("x = " + x); break;
- }
- } while (ch!=4);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement