Alx09

Ex11

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