Commit f2fac9ea by makuks

Upload New File

parent 8bd73eab
Showing with 28 additions and 0 deletions
#include <stdio.h>
int convert(int);
int main()
{
int dec, bin;
printf("Enter number: ");
scanf("%d", &dec);
bin = convert(dec);
printf("The binary version of %d is %d.\n", dec, bin);
return 0;
}
int convert(int dec)
{
if (dec == 0)
{
return 0;
}
else
{
return (dec % 2 + 10 * convert(dec / 2));
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment