Tobiahao

REKURENCJA_01

Mar 22nd, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.41 KB | None | 0 0
  1. /*
  2. Napisz program, w którym zdefiniujesz funkcję rekurencyjną konwertującą zapis dziesiętny liczby naturalnej większej od zera na zapis ósemkowy.
  3. */
  4.  
  5. #include <stdio.h>
  6.  
  7. void convert_to_octal(unsigned long int number)
  8. {
  9.     if(number){
  10.         convert_to_octal(number/8);
  11.         printf("%lu", number%8);
  12.     }
  13. }
  14.  
  15. int main(void)
  16. {
  17.     convert_to_octal(100);
  18.     printf("\n");
  19.     return 0;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment