Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main(){
- int numero_decimale, resto, n_volte, i, contatore;
- int numero_binario[contatore];
- contatore = 0;
- printf("inserisci il numero decimale");
- scanf("%d", &numero_decimale);
- while(resto>0){
- if (contatore==0){
- n_volte = numero_decimale / 2;
- resto = numero_decimale % 2;
- numero_binario[contatore] = resto;
- }
- else if(contatore > 0){
- n_volte = resto/2;
- resto = resto/2;
- numero_binario[contatore] = resto;
- }
- contatore++;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement