Home  >  Article  >  Backend Development  >  C# Learning Diary 10----Extra Chapter C Language Base Conversion

C# Learning Diary 10----Extra Chapter C Language Base Conversion

黄舟
黄舟Original
2017-01-20 13:39:551568browse

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:

C# Learning Diary 10----Extra Chapter C Language Base Conversion

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)!


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn