Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Ultimo avance de pregunta 1 guía4
#include <stdio.h> #include <string.h> #include <stdlib.h> void baseConversion(unsigned long long, unsigned short); void investNumber(char *); int main(void) { unsigned long long number = 1001; unsigned short baseNumber = 2; char vector[101]; baseConversion(number, baseNumber); return 0; } void baseConversion(unsigned long long number, unsigned short base) { short i; char sum[101]; unsigned long long rest; char numbers[17] = "0123456789ABCDEF"; //char *array = sum; i = 0; while ( number > 0) { rest = number % base; sum[i] = numbers[rest]; number /= base; i ++; } sum[i] = '\0'; /* printf("Numbero sin Invertir\n"); printf("%s", sum);*/ investNumber(sum); printf("%s\n", sum); } void investNumber(char *number) { char *digit = number; char num[101]; unsigned short length; short i; length = strlen(number); num[length] = '\0'; for (i = length - 1 ; i >= 0 ; i--) { num[i] = *digit; digit ++; } strcpy(number, num); //printf("\n%s", num); }
run
|
edit
|
history
|
help
0
A_141124Burbuja
Lab6 v1.0 Sin,cos,tan,cot
FUNCTIONS Shape functions
SAI_1-6.c
llist.h
Lab 5 HW Spring 2017 v0.5
ptr[]
Finite State Machine Program Example (ECE 2534)
program
19_1_7