Advertisement
paulogp

Divisão e resto (v. 1.0.1)

Jul 13th, 2011
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.64 KB | None | 0 0
  1. // Apple Xcode
  2.  
  3.  
  4. #include <stdio.h>
  5.  
  6. int main (int argc, const char * argv[])
  7. {
  8.     // insert code here...
  9.     int the_quocient = 0;
  10.     int the_div = 0;
  11.  
  12.     int the_result_div = 0;
  13.     int the_result_rest = 0;
  14.  
  15.     int the_flag = 0;
  16.  
  17.     while (the_flag == 0) {
  18.         printf("Insira o quociente: ");
  19.         scanf("%i", &the_quocient);
  20.  
  21.         printf("Insira o dividendo: ");
  22.         scanf("%i", &the_div);
  23.  
  24.         if (the_div == 0) {
  25.             the_flag = 1;
  26.         } else {
  27.             the_result_div = the_quocient / the_div;
  28.             printf("div = %i\n", the_result_div);
  29.  
  30.             the_result_rest = the_quocient % the_div;
  31.             printf("rest = %i\n", the_result_rest);
  32.         }
  33.     }
  34.  
  35.     return 0;
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement