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