seergiomv

ejercicio 12.2

Oct 23rd, 2019
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.29 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <math.h>
  3.  
  4. int main() {
  5.     int n1, n2, n3;
  6.     float r, c;
  7.     printf("Introduce un numero:\n");
  8.     scanf("%d",&n1);
  9.     printf("Introduce un numero:\n");
  10.     scanf("%d",&n2);
  11.     printf("Introduce un numero:\n");
  12.     scanf("%d",&n3);
  13.     if (n1> n2 && n1>n3){
  14.         if (n2>n3){
  15.             r = n1 % n3; c = trunc(n1/(float)n3);
  16.             printf("%d dividido | entre %d\n \tR:%.0f \tC:%.0f", n1, n3, r, c);
  17.         } else {
  18.             r = n1 % n2; c = trunc(n1/(float)n2);
  19.             printf("%d dividido | entre %d\n \tR:%.0f \tC:%.0f", n1, n2, r, c);
  20.         }
  21.     }else if (n2> n3 && n2>n1){
  22.         if (n1>n3){
  23.             r = n2 % n3; c = trunc(n2/(float)n3);
  24.             printf("%d dividido | entre %d\n \tR:%.0f \tC:%.0f", n2, n3, r, c);
  25.         } else {
  26.             r = n2 % n1; c = trunc(n2/(float)n1);
  27.             printf("%d dividido | entre %d\n \tR:%.0f \tC:%.0f", n2, n1, r, c);
  28.         }
  29.     } else if (n3> n2 && n3>n1){
  30.         if (n1>n2){
  31.             r = n3 % n2; c = trunc(n3/(float)n2);
  32.             printf("%d dividido | entre %d\n \tR:%.0f \tC:%.0f", n3, n2, r, c);
  33.         } else {
  34.             r = n3 % n1; c = trunc(n3/(float)n1);
  35.             printf("%d dividido | entre %d\n \tR:%.0f \tC:%.0f", n3, n1, r, c);
  36.         }
  37.     }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment