Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace test
- {
- class Program
- {
- static int nod (int a, int b)
- {
- while (a != b ) {
- if (a > b)
- a -= b;
- else
- b -= a;
- }
- int nod = a;
- return nod;
- }
- static void Main ()
- {
- Console.WriteLine ("Enter a & b ");
- int a = int.Parse (Console.ReadLine ());
- int b = int.Parse (Console.ReadLine ());
- int x = a * a + b * b;
- int y = a * b;
- Console.WriteLine("{0}/{1}", (double)x/nod(x,y), (double)y/nod(x,y));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment