HDOJ1001 Sum Problom
HDOJ10001 Sum Problem
Accepted.
代码如下:
1 #include<stdio.h> 2 int main() 3 { 4 int n; 5 while(scanf("%d",&n)!=EOF) 6 { 7 int i,sum = 0; 8 for(i=1;i<=n;i++) 9 { 10 sum+=i; 11 } 12 printf("%d\n\n",sum); 13 } 14 return 0; 15 }
HDOJ10001 Sum Problem
Accepted.
代码如下:
1 #include<stdio.h> 2 int main() 3 { 4 int n; 5 while(scanf("%d",&n)!=EOF) 6 { 7 int i,sum = 0; 8 for(i=1;i<=n;i++) 9 { 10 sum+=i; 11 } 12 printf("%d\n\n",sum); 13 } 14 return 0; 15 }