Advertisement
Guest User

Sembra funzionare

a guest
Oct 21st, 2016
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. int main () {
  4. int a,b,z,i,r,q,m,s,j,k,x;
  5.  
  6. do{
  7. system ("cls");
  8. printf("Inserisci primo numero\n");
  9. printf("\n");
  10. scanf("%d",&a);
  11. printf("\n");
  12. k=a;
  13. printf("Inserisci secondo numero\n");
  14. printf("\n");
  15. scanf("%d",&b);
  16. printf("\n");
  17. j=b;
  18. m=(a<b?b:a);
  19. z=1;
  20. i=2;
  21. do{
  22. do{
  23. if(!(r=a%i)) a/=i;
  24. if(!(q=b%i)) b/=i;
  25. if (!(s=r*q)) z*=i;
  26. }while(!s);
  27. if(i<m) i++;
  28. }while(i<m);
  29. if((z==k && i==j) || (z==j && i==k) ){z=k*j;
  30. }
  31. printf("m.c.m.=%d \n",z);
  32. printf("\n");
  33.  
  34. printf("Vuoi continuare? 1=si 0=no\n");
  35. printf("\n");
  36. scanf("%d",&x);
  37. printf("\n");
  38. if (x<0 || x >1)
  39. do{printf("Errore nei dati\n");
  40. printf("\n");
  41. printf("Vuoi continuare? 1=si 0=no\n");
  42. printf("\n");
  43. scanf("%d",&x);
  44. system ("cls");
  45. }while (x>1 || x<0);
  46. if (x==0) {
  47. exit (1);
  48. }
  49. }while (x==1);
  50.  
  51.  
  52.  
  53.  
  54.  
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement