寻求帮助!!! 望百忙中的高手解决一下~~~~~~~~~~~
C语言用调用和for求1加到100的和!如果可以请指教一下我写的错误 感激不尽!
#include"stdio.h"
int da(int n1,int n2)
{
int sum,i;
for(i=n1;i<=n2;i++)
sum=sum+i;
return(sum);
}
main()
{
int a=1,b=100;
int c;
c=da(a,b);
printf("%d \n",c);
}
#include <stdio.h> int da(int n1, int n2) { int sum = 0, i = 0; for(i = n1; i <= n2; i++) sum += i; return sum; } int main(void) { int a = 1, b = 100; int c = 0; c = da(a, b); printf("%d \n", c); return 0; }