程序代码:
#include<stdio.h> unsigned long long pow(int number,int n); void main() { int n,t; unsigned long long sum=1; printf("位数:\n"); scanf("%d",&n); for(t=2;t<=n;t++) sum=sum*10+pow(10,t-1); if(n==1) sum=1; printf("\n%lld\n",sum); } unsigned long long pow(int number,int n) {unsigned long long sum=1; int t; for(t=0;t<n;t++) sum=sum*number; return sum; }
错了,题目都没有看清,算的是1-9999 9999 9999 9,范围就错了,悲剧啊,再改!
[ 本帖最后由 饭桶 于 2012-6-19 23:56 编辑 ]
人得一生得奋斗!