Advertisement
Joao_Joao

Questão 258 Lista de Exercícios IFPB

May 21st, 2022
685
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2.  
  3. void bin(int n) {
  4.   if(n == 1) {
  5.     printf("1");
  6.     return;
  7.   }
  8.   bin(n / 2);
  9.   printf("%d", n % 2);
  10. }
  11.  
  12. void main() {
  13.   int n;
  14.   scanf("%d", &n);
  15.   printf("Valor correspondente em binario: ");
  16.   bin(n);
  17.   printf("\n");
  18. }
  19.  
Advertisement
RAW Paste Data Copied
Advertisement