import java.sql.SQLOutput;
import java.util.Scanner;
public class bus {
public static void main(String[] args) {
//键盘录入
Scanner scanner = new Scanner(System.in);
//初始人数
int people =0;
System.out.println("---------- 欢迎乘坐公交车 -----------");
//循环
for(int i=1;i<=6;i++) {
if(i <= 6){
//上车人数
System.out.println("第"+ i +"站公交车上车人数为:");
int up = scanner.nextInt();
//下车人数
System.out.println("第"+ i +"站公交车下车人数");
int down = scanner.nextInt();
//到下一站之后公交车内剩余的人数
people +=(up - down);
System.out.println("第"+ i +"站公交车内剩余的人数"+ people +"人");
}else{
System.out.println("本趟公交车已到站,请有序下车,祝你旅途愉快");
}
}
}
}
02-15
8万+
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
03-01
2760
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)