Advertisement
Guest User

wewe

a guest
Mar 5th, 2015
228
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main()
  4. {
  5. int Decimal;
  6. int i;
  7. int j;
  8. int q;
  9. int Bin[32];
  10. q=1;
  11.  
  12. printf("Entrez le nombre decimal a convertir:\n");
  13. scanf("%d", &Decimal);
  14.  
  15. for (i=0 ; i<=31 ; i++)
  16. {
  17. Bin[i]=0;
  18. }
  19. j=0;
  20.  
  21.  
  22. while (q>0)
  23. {
  24. q=Decimal/2;
  25. Bin[j]=Decimal%2;
  26. Decimal=q;
  27. j++;
  28.  
  29. }
  30.  
  31. for (i=j-1 ;i>=0; i--)
  32. {
  33. printf("%d", Bin[i]);
  34. }
  35.  
  36. return 0;
  37.  
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement