Alx09

Untitled

May 12th, 2020
1,449
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.33 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. unsigned f1(int a, int b) {
  5.     if (b == 0)
  6.         return a;
  7.     return f1(b, a % b);
  8. }
  9.  
  10.  
  11. int main() {
  12.     int a, b;
  13.     FILE *f;
  14.     f = fopen("in.txt", "r");
  15.     fscanf(f, "%d%d", &a, &b);
  16.     fclose(f);
  17.     f = fopen("out.txt", "w");
  18.     fprintf(f, "%u %u", f1(a, b), a*b / f1(a, b));
  19.     fclose(f);
  20.     return 0;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment