麻烦各位师兄一下
下面的程序运行成功但结果错误,怎么办啊
# include <conio.h> # include <stdio.h>
long fun (int a, int n) { int j ; long s =0, t=0; for (j=0; j<n; j++) t=t*10+a; s=t; for (j=1; j<=n; j++) { t=t/10; s=s - t; } return (s); }
main ( ) { int a, n;
clrscr ( ); printf ("\nPlease enter a and n :"); scanf ("%d%d", &a, &n); printf ("The value of function is : %1d\n", fun (a, n)); }