Advertisement
Guest User

Patch 1.0 By Modz54

a guest
Oct 21st, 2016
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 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. do{
  8. system ("cls");
  9. printf("Inserisci primo numero\n");
  10. printf("\n");
  11. scanf("%d",&a);
  12. printf("\n");
  13. k=a;
  14. printf("Inserisci secondo numero\n");
  15. printf("\n");
  16. scanf("%d",&b);
  17. printf("\n");
  18. j=b;
  19.  
  20. if (a<=0|| b<=0){
  21. printf ("Errore:i numeri devono essere entrambi maggiori di 0\n");
  22. printf ("\n");
  23. system("PAUSE");
  24. }
  25. }while (a<=0 || b<=0);
  26.  
  27.  
  28. m=(a<b?b:a);
  29. z=1;
  30. i=2;
  31. do{
  32. do{
  33. if(!(r=a%i)) a/=i;
  34. if(!(q=b%i)) b/=i;
  35. if (!(s=r*q)) z*=i;
  36. }while(!s);
  37. if(i<m) i++;
  38. }while(i<m);
  39. if((z==k && i==j) || (z==j && i==k) ){z=k*j;
  40. }
  41. if (k==j){printf ("m.c.m=%d\n",k);
  42. }else{
  43.  
  44. printf("m.c.m.=%d \n",z);
  45. }
  46. printf("\n");
  47.  
  48. printf("Vuoi continuare? 1=si 0=no\n");
  49. printf("\n");
  50. scanf("%d",&x);
  51. printf("\n");
  52. if (x<0 || x >1)
  53. do{printf("Errore nei dati\n");
  54. printf("\n");
  55. printf("Vuoi continuare? 1=si 0=no\n");
  56. printf("\n");
  57. scanf("%d",&x);
  58. system ("cls");
  59. }while (x>1 || x<0);
  60. if (x==0) {
  61. exit (1);
  62. }
  63. }while (x==1);
  64.  
  65.  
  66.  
  67.  
  68.  
  69. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement