import java.lang.*;
import javax.swing.JOptionPane;
public class Days{
public static void main(String args[]){
String str1,str2,str3;
double year,month,day,sum=0;
int i;
int a[]={31,28,31,30,31,30,31,31,30,31,30,31};
str1=JOptionPane.showInputDialog(null,"请输入年","suhao",JOptionPane.QUESTION_MESSAGE);
year=Double.parseDouble(str1);
str2=JOptionPane.showInputDialog(null,"请输入月","suhao",JOptionPane.QUESTION_MESSAGE);
month=Double.parseDouble(str2);
str3=JOptionPane.showInputDialog(null,"请输入日","suhao",JOptionPane.QUESTION_MESSAGE);
day=Double.parseDouble(str3);
if(year%4==0&&year%100!=0||year%400==0)
a[1]=29;
if(month==0)
sum=day;
else
{
for(i=0;i<month-1;i++)
sum+=a[i];
sum+=day;
}
System.out.println("该天是该年的第"+sum+"天");
}
}
拿到机器上编译看看!!应该能行!!好好学习,天天向上!!共勉!
温馨提示:答案为网友推荐,仅供参考