import java.util.Scanner;
public class Test
{
public static void main(String args[])
{
Scanner scan = new Scanner(System.in);
int count = 0;
int num = scan.nextInt();
for(int i = 1;i<=num;i++){
count +=i;
}
System.out.println(count);
}
}
import java.util.Scanner;
public class Test
{
public static void main(String args[])
{
Scanner scan = null ;
int num = 0;
try{
scan = new Scanner(System.in);
num = scan.nextInt();
}catch(Exception e){
System.out.println("Exception: " +e.getMessage());
}
int count = 0;
for(int i = 1;i<=num;i++){
count += i;
}
System.out.println(count);
}
}
控制台的?