package test1;
public class Demo {
public static void main(String[] args) {
int n = 100 ;
System.out.println( (int)(Math.pow( n , 2) + n ) >> 1 ) ;
System.out.println( go( n ) );
}
public static int go( int n ){
return n == 1 ? 1 : n + go( --n ) ;
}
}
不用if,循环,*和/的