Advertisement
Guest User

Untitled

a guest
Aug 20th, 2014
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.60 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <time.h>
  4. #include <math.h>
  5.  
  6. int main()
  7. {
  8.     srand(time(NULL));
  9.  
  10.     int m=0;
  11.     int dividendo=0;
  12.     int divisor=0;
  13.     int cociente=0;
  14.     int residuo=0;
  15.     int num=0;
  16.  
  17.     m=rand()%11;
  18.  
  19.     if(m<6) m=5;
  20.     else m=4;
  21.  
  22.     num=pow(10,m);
  23.  
  24.     dividendo=rand()%num;
  25.     divisor=rand()%100;
  26.  
  27.     printf("Dividendo: %d", dividendo);
  28.     printf("\tDivisor: %d", divisor);
  29.  
  30.     cociente=dividendo/divisor;
  31.     residuo=dividendo%divisor;
  32.  
  33.     printf("\nCociente: %d",cociente);
  34.     printf("\tResto: %d",residuo);
  35.     return 0;
  36.  
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement