#include <stdio.h>
int main()
{
int n;
printf("Enter an octal number: ");
scanf("%o",&n); /*Takes number in octal format. */
/* %o and %x will display the number is octal format and hexadecimal form respectively. */
printf("%o in octal = %x in hexadecimal", n, n);
printf("\nEnter an hexadecimal number: ");
scanf("%x",&n); /* Takes number in hexadecimal format.*/
printf("%x in hexadecimal = %o in octal", n, n);
return 0;
}
int main()
{
int n;
printf("Enter an octal number: ");
scanf("%o",&n); /*Takes number in octal format. */
/* %o and %x will display the number is octal format and hexadecimal form respectively. */
printf("%o in octal = %x in hexadecimal", n, n);
printf("\nEnter an hexadecimal number: ");
scanf("%x",&n); /* Takes number in hexadecimal format.*/
printf("%x in hexadecimal = %o in octal", n, n);
return 0;
}
No comments:
Post a Comment