Code:
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
int main()
{
int input = 0;
int i;
unsigned int mask = 0x80000000; //how many bits to output in the correct way
The mask only ensures that we start with the highest bit.
Code:
printf("Enter a Base 10 Number: "); //user to enter number
scanf("%i", &input); //input the number and start input as '0'
That comment is wrong.
Code:
system("cls");//clears the screen to show the outputs clearer
printf ("Hex : %x,\n\n");
I find it interesting that you aren't passing anything to printf().
Code:
printf("Binary : ");
for (i=0; i<32; i++) //increment 'i' if it is more than '0' but less that '32'
No ......... Avoid comments that don't add information.
Code:
{
if ((i%4==0) && (i!=0)) //for ever 4 digits outputed by i put in a space
printf(" "); //space
printf("%d",(input&mask)?1:0); //print the binary number in 1's and 0's
mask /=2; //put it in base 10
This comment is also wrong.
Code:
}
printf("\n\n"); //new line
printf ("Base 10: %d,\n\n"); //shows the base 10 number
Again you aren't passing anything to printf().