摘要: #include<stdio.h>int main(){/*求0-7所能组成的奇数的个数*/long sum=4, s=4;int j;for (j=2; j<=8; ++j){printf("\n%ld", sum);if (j<=2)//最高位不能为0s*=7;//s=s*7;elses*=8;//s=s*8;sum+=s;}printf("\nsum=%ld",sum);return 0;} 阅读全文
posted @ 2013-03-01 22:58 王井玉 阅读(326) 评论(0) 推荐(0) 编辑
摘要: #include<stdio.h>int main(){/*八进制转换成十进制*/char *p, s[6];//字符串的类型为charint n;p=s;gets(p);n=0;while(*p!='\0'){n=n*8+*p-'0';//printf("n=%d *p-'0'=%d\n", n, *p-'0');*p++;}printf("%d\n",n);return 0;} 阅读全文
posted @ 2013-03-01 20:49 王井玉 阅读(737) 评论(0) 推荐(0) 编辑
摘要: #include <stdio.h>int output(int number1, int number2, int number3){ printf("809*%ld = 800*%ld + 9*%ld + 1\n",number1, number2, number3); //printf("809*%ld=%ld\n",number1, 809*number1); return 0;}int main(){ /*809*??=800*??+9*??+1,??为两位数,8*??为两位数,9*??为三位数,求??的值及809*??的值*/ i 阅读全文
posted @ 2013-03-01 19:30 王井玉 阅读(1091) 评论(0) 推荐(0) 编辑