根据天数(46)计算周数和剩余的天数

import java.util.Scanner;
public class Week {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println(“请输入天数”);
int sum = sc.nextInt();
int week;
int day;
week = sum / 7;
day = sum - week * 7;
System.out.println(“周数:” + week);
System.out.println(“天数:” + day);

}

}
根据天数(46)计算周数和剩余的天数_第1张图片

你可能感兴趣的:(原创)