Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Security.Cryptography;
- using System.Text;
- using System.Threading.Tasks;
- namespace ConsoleApp3
- {
- class Program
- {
- static void Main()
- {
- Console.Write("Введите число а: ");
- int a = int.Parse(Console.ReadLine());
- Console.Write("Введите число b: ");
- int b = int.Parse(Console.ReadLine());
- int c = a * a + b * b;
- int d = a * b;
- int c1 = c;
- int d1 = d;
- while (c > 0 && d > 0)
- {
- if (c > d)
- {
- c %= d;
- }
- else
- {
- d %= c;
- }
- }
- int res = c + d;
- c1 /= res;
- d1 /= res;
- Console.WriteLine("a/b + b/a = {0}/{1}", c1, d1);
- Console.WriteLine("нод = {0}, {1}, {2}", res, c, d);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement