answersLogoWhite

0


Best Answer

#include void main(void) { char base_digits[16] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'}; int converted_number[64]; long int number_to_convert; int next_digit, base, index=0; /* get the number and base */ printf("Enter number and desired base: "); scanf("%ld %i", &number_to_convert, &base); /* convert to the indicated base */ while (number_to_convert != 0) { converted_number[index] = number_to_convert % base; number_to_convert = number_to_convert / base; ++index; } /* now print the result in reverse order */ --index; /* back up to last entry in the array */ printf("\n\nConverted Number = "); for( ; index>=0; index--) /* go backward through array */ { printf("%c", base_digits[converted_number[index]]); } printf("\n"); }

User Avatar

Wiki User

15y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Base Conversion program in c language?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Different parts of c language program?

what are the parts of C language program


What is Compilation Process?

In simple words, it is the conversion of a high level language to an assembly level language. In C, it is the conversion of a .c file to a .s file


Can you write a program in DBMS like C?

DBMS means Data Base Management System, it is not a programming language.


What has the author David Spuler written?

David Spuler has written: 'Comprehensive C' -- subject(s): C (Computer program language) 'C++ and C efficiency' -- subject(s): C++ (Computer program language), C (Computer program language)


Program for sin series in c language?

find the program in c-pgms.blogspot.com


C program was introduced in the year?

c program was introduced in the year 1972 by Dennis RitchieNo, it was the C language, not the C program.


What has the author Conor Sexton written?

Conor Sexton has written: 'Newnes C++ pocket book' -- subject(s): C (Computer program language), C++ (Computer program language) 'C pocket book' -- subject(s): C (Computer program language) 'Y2K7'


What do you mean by c taken programming in c?

A C program is a computer program written using the C programming language.


What has the author Steve Schustack written?

Steve Schustack has written: 'C for fun and profit' -- subject(s): C (Computer program language) 'Variations in C' -- subject(s): C (Computer program language) 'C for fun and profit' -- subject(s): C (Computer program language) 'Variations In C Edition'


Is c an object oriented programing language?

C language is not a program, and it isn't an object-oriented language either.


How there is security in c language?

The c language is as secure or as insecure as the programmer makes it. Security is not in the language; it is in the design of the program.


Pretty good privacy program in c language?

Yes, PGP is written in C-language.