这里能讨论下C语言编程吗?我编了个进位计算的,想请各位看一下。

2 views
Skip to first unread message

Billy

unread,
Mar 4, 2009, 2:43:15 AM3/4/09
to 南京大学OPEN技术论坛
#include "stdio.h"
void main()
{int a[40]; /*array to save */
int i,j,N;
int p; /* to save adding*/
int sum;

printf("Please enter the Number: ");
scanf("%d",&N);
for (i=0;i<40;i++)
a[i]=0;
a[0]=1;
p=0;
for (i=1;i<=N;i++)
for(j=0;j<=40;j++)
{sum=a[j]*i+p;
a[j]=sum%10;
p=sum/10;
}
printf("The answer is: %d!=",N);
for(i=0;i<40;i++)
printf("%d",a[i]);
}

不知道哪里出错了,还没有调试的,因为不会搞eclipse。各位大侠帮下忙吧?多谢了。

开颜

unread,
Mar 4, 2009, 8:54:12 AM3/4/09
to ope...@googlegroups.com


2009/3/4 Billy <zhao...@gmail.com>



--
此致敬礼
颜开
Windows下eclipse的C++环境配置.pdf
Reply all
Reply to author
Forward
0 new messages