close
import java.util.Scanner;
public class FF
{
public static void main ( String args[] )
{
Scanner input = new Scanner (System.in);
int x;
int count = 1 ;
int are = 0;
System.out.print ("請輸入數字");
x = input.nextInt();
while ( count <= x )
{
are = are + count ;
count++;
}
System.out.printf( "從1連加到%d的和為%d" , x , are );
}
}
全站熱搜
留言列表