import java.util.Scanner;
public class Test{
public static void main(String args[ ])
{
try{ while(true) { Scanner scanner = new Scanner(System.in); String str= scanner.nextLine(); int i=Integer.parseInt(str);//将字符串转换成整型 int count=0; if(i<5) {for(;i>=0;i--) count+=i; System.out.println(count);} else { System.out.println("请输入小于或等于5的整数"); } } } catch(Exception e){ String ero=e.toString(); System.out.println(ero); } } }