Home >Backend Development >C#.Net Tutorial >C# Learning Diary 10----Extra Chapter C Language Base Conversion
I left a question in C# Learning Diary 08---Character Type: How to write a hexadecimal conversion program in C. Now I will eradicate this sequelae:
#include<stdio.h> int main() { printf("请输入一个十进制数:"); int a; scanf("%d",&a); printf("十进制 %d 的十六进制是: %x\n",a,a); // %d十进制转义符 %x 十六进制转义符 printf("十进制 %d 的八进制是: %o\n",a,a); // %o 八进制转义符 return 0; }
Debug:
No problem, the result is correct! !
The above is the content of C# Learning Diary 10----Extra Chapter C language binary conversion. For more related content, please pay attention to the PHP Chinese website (www.php.cn)!