Advertisement
Guest User

1

a guest
Jun 20th, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. static public string Sokr()
  2. {
  3. Console.WriteLine("Введіть чисельник");
  4. int p = Convert.ToInt32(Console.ReadLine());
  5. Console.WriteLine("Введіть знаменник");
  6. int q = Convert.ToInt32(Console.ReadLine());
  7. int nod = 0;
  8. for (int i = 1; i < (p * q + 1); i++)
  9. {
  10. if (q % i == 0 && p % i == 0)
  11. {
  12. nod = i;
  13. }
  14. }
  15. int n = nod;
  16. p = p / n;
  17. q = q / n;
  18. string h = Convert.ToString(p);
  19. string hh = Convert.ToString(q);
  20. string s =
  21. return s;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement