#include <stdio.h> int main( void ) { unsigned long long n; printf("输入一个八进制数:"); scanf( "%llu", &n ); unsigned long long result = 0; for( unsigned long long base=1; n!=0; base*=8, n/=10 ) result += n%10 * base; printf( "十进制数为: %llu\n", result ); }
#include<stdio.h> int main( ) { int x; scanf("%o",&x); printf("x=%d\n",x); return 0; }