Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.IO;
- namespace ConsoleApplication
- {
- class Program
- {
- static long NOK(int a, int b, int c, int max)
- {
- long result = calcNok(a, b);
- result = calcNok(result, c);
- return result;
- }
- static long calcNok(long num1,long num2)
- {
- return num1*num2/calcNod(num1,num2);
- }
- static long calcNod(long a,long b)
- {
- return b == 0 ? a : calcNod(b, a % b);
- }
- static void Main(string[] args)
- {
- StreamReader fin = new StreamReader("input.txt");
- string[] numb = fin.ReadLine().Split(' ');
- fin.Close();
- int a = int.Parse(numb[0]);
- int b = int.Parse(numb[1]);
- int c = int.Parse(numb[2]);
- int max;
- if ((a > b) && (a > c))
- max = a;
- else max = b > c ? b : c;
- StreamWriter fout = new StreamWriter("output.txt");
- fout.Write("{0}", NOK(a, b, c, max));
- fout.Close();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement