2010-10-12

使用命令提示字元
計算總和

int i,n;
int sum=0;
String s = Console.ReadLine();
n = int.Parse(s);
for (i = 1; i<=n; i++)
 sum = i + sum;
 //string sum= sum.ToString();
Console.WriteLine(sum);
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License