Menu Close

八进制转换为十进制

八进制转换为十进制

#include<stdio.h>
#include<stdlib.h>
int main()
{
   int n=0,i=0;
   char s[20];
   printf("please input a Octal :\n");
   gets(s);
   while(s[i]!='\0'){
   n=n*8+s[i]-'0';
   i++;
  }
  printf("changed to decimal\n%d\n",n);
  return 0;
}

除教程外,本网站大部分文章来自互联网,如果有内容冒犯到你,请联系我们删除!

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注

Leave the field below empty!

Posted in C语言习题集

Related Posts