candrei98

Untitled

Jan 14th, 2019
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. void programul_3() {
  2.  
  3. int a, b, cmmmc, rest;
  4. int x, y;
  5.  
  6. printf("Introduceti primul numar intreg pozitiv\na = ");
  7. scanf("%d", &a);
  8.  
  9. while (a < 1){
  10.  
  11. printf("\nReintroduceti a = ");
  12.  
  13. scanf("%d", &a);
  14. }
  15.  
  16. printf("\nIntroduceti cel de-al doilea numar intreg pozitiv\nb = ");
  17. scanf("%d", &b);
  18.  
  19. while (b < 1){
  20. printf("\nReintroduceti b = ");
  21. scanf("%d", &b);
  22. }
  23.  
  24. x = a;
  25. y = b;
  26.  
  27. while (b != 0){
  28. rest = a % b;
  29. a = b;
  30. b = rest;
  31. }
  32.  
  33. printf("\nCmmdc = %d ", a);
  34.  
  35. cmmmc = (x*y) / a;
  36.  
  37. printf("\nCmmmc = %d ", cmmmc);
  38.  
  39. _getch();
  40. }
Advertisement
Add Comment
Please, Sign In to add comment