Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class PieceOfCake
- {
- static void Main()
- {
- long A = long.Parse(Console.ReadLine());
- long B = long.Parse(Console.ReadLine());
- long C = long.Parse(Console.ReadLine());
- long D = long.Parse(Console.ReadLine());
- long nominator = (A * D) + (B * C);
- long denominator = (B * D);
- decimal division = (decimal)nominator / denominator;
- if (division >= 1)
- {
- Console.WriteLine("{0}", (long)division);
- }
- else
- {
- Console.WriteLine("{0:F22}", division);
- }
- Console.WriteLine("{0}/{1}", nominator, denominator);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement