import ConsoleReader.*;
public class ex3
{
public static void main(String args[])
{
System.out.print("輸入一個正整數 :");
ConsoleReader console =
new ConsoleReader(System.in);
int N = console.readInt();
int count=0;
for(int i=0;i<N;i++)
{
count=count+i;
}
System.out.print("1至N累加總合為 :"+count);
}
}
|