SHARE
TWEET

Untitled

a guest Mar 26th, 2020 56 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. void recDecToBin(int n, char* result){
  2.     char str[2];
  3.     int ost;
  4.     ost = n%2;
  5.     if(n>0){
  6.         recDecToBin(n/2, result);
  7.         sprintf(str,"%d", ost);
  8.         strcat(result, str);
  9.     }
  10. }
  11.  
  12.  
  13. int main(){
  14.     int n;
  15.     char result[30]="";
  16.     scanf("%d", &n);      
  17.     recDecToBin(n,result);
  18.     puts(result);
  19.     return 0;          
  20. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top