A leap year is a year with 366 days.A leap year has the 29th
来源:学生作业帮 编辑:作业帮 分类:综合作业 时间:2024/05/14 17:15:46
A leap year is a year with 366 days.A leap year has the 29th February.A year is a leap year if it is divisible by 4 except for
the century years (divisible by 100).Century years are only leap years if they are divisible by 400.Write a program that
accepts a year and determines if it is a leap year.
\x05\x05\x05\x05
\x05\x05\x05
\x05\x05\x05
\x05\x05\x05\x05
\x05\x05\x05\x05\x05
Use a separate method to test if a year is a leap year.
my answer:
import java.util.Scanner;
public class JavaApplication24 {
public static void main(String[] args) {
Scanner input=new Scanner(System.in);
System.out.print("Enter a year:");
int a=input.nextInt();
if((a is divisible by 4 || a is divisible by 400)){
System.out.println("a");
}else {
System.out.println("a is not a leap year");
}}
}
运行不出来?
the century years (divisible by 100).Century years are only leap years if they are divisible by 400.Write a program that
accepts a year and determines if it is a leap year.
\x05\x05\x05\x05
\x05\x05\x05
\x05\x05\x05
\x05\x05\x05\x05
\x05\x05\x05\x05\x05
Use a separate method to test if a year is a leap year.
my answer:
import java.util.Scanner;
public class JavaApplication24 {
public static void main(String[] args) {
Scanner input=new Scanner(System.in);
System.out.print("Enter a year:");
int a=input.nextInt();
if((a is divisible by 4 || a is divisible by 400)){
System.out.println("a");
}else {
System.out.println("a is not a leap year");
}}
}
运行不出来?
a is divisible by 4 || a is divisible by 400)
改成
a%4==0 || a %400==0
再问: 谢谢!!!!!这样就可以了!!!为什么啊???
再答: a is divisible by 4 || a is divisible by 400
这不是英语作文,,你这不是java的语法。%在java中代表模。即除以后的余数
改成
a%4==0 || a %400==0
再问: 谢谢!!!!!这样就可以了!!!为什么啊???
再答: a is divisible by 4 || a is divisible by 400
这不是英语作文,,你这不是java的语法。%在java中代表模。即除以后的余数
How many days are there in a leap year?回答
when is the next leap year (366 days)?
A leap year comes once in ____years
c语言,if(year%4==0&&year%100!=0) printf("%d is a leap year.\n"
matlab中fprintf('%4d year is a leap year.\n',year)这句话里面'%4d是什
How many turn does the Earth make in a leap year?怎么回答
求电影《Leap Year》音乐
For Chinese,2008 is a special year,a year( )the 29th Olympic
days (be) a year
which months of the year have 30 days.the year能换成a year吗
( )is the last month of a year.A.play with
帮我改改,int days=sum_day(month,day); if(leap(year)&&month>2) da