USING UNIX CHECK EXAMPLES BELOWSolutioninclude int mainvoid

#############################USING UNIX CHECK EXAMPLES BELOW################################

Solution

#include <stdio.h>
int main(void) {
int decimal, base, k=0, i, r;
char result[64];
char basechars[] = \"0123456789ABCDEF\";
printf(\"Enter decimal and base: \");
   fflush(stdout);
scanf(\"%d\", &decimal);
scanf(\"%d\", &base);
if (base < 2) {
printf(\"Your base is too low! \ \");
} else if (base > 16) {
printf(\"Your base is too high! \ \");
} else if (decimal == 0) {
printf(\"%d \ \", 0);
} else {
while (decimal != 0) {
r = decimal % base;
decimal = decimal / base;
result[k++] = basechars[r];
}
for (i = k - 1; i >= 0; --i) {
printf(\"%c\", result[i]);
}
}
return 0;
}

#############################USING UNIX CHECK EXAMPLES BELOW################################Solution#include <stdio.h> int main(void) { int decimal, base,

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site