Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static public string Sokr()
- {
- Console.WriteLine("Введіть чисельник");
- int p = Convert.ToInt32(Console.ReadLine());
- Console.WriteLine("Введіть знаменник");
- int q = Convert.ToInt32(Console.ReadLine());
- int nod = 0;
- for (int i = 1; i < (p * q + 1); i++)
- {
- if (q % i == 0 && p % i == 0)
- {
- nod = i;
- }
- }
- int n = nod;
- p = p / n;
- q = q / n;
- string h = Convert.ToString(p);
- string hh = Convert.ToString(q);
- string s =
- return s;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement