Hogy-Bear

Q4

Feb 8th, 2018
239
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.34 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. long long base10to2 (int base10_number);
  4.  
  5. int main(int argc, char const *argv[]) {
  6.   printf("%lld\n",base10to2(3));
  7.   return 0;
  8. }
  9.  
  10. long long base10to2 (int base10_number){
  11.     if (base10_number == 0) {
  12.       return 0;
  13.     }else{
  14.       return ( base10_number % 2 + 10 * base10to2(base10_number / 2) );
  15.     }
  16. }
Advertisement
Comments
  • User was banned
Add Comment
Please, Sign In to add comment