第五周上机作业
public class fff { public static viod main(string[]args){ for(int m,b,s=0,j; {m=i;s=0; do{ b=m%10; s=s+b*b*b; m=m/10; }while(m!=0); if(s==i) {a[j]=s;j++;}
} System.out.print("水仙花数:\n"); } System.out.println("%d\n",a[i]); return 0; } }
pubilc class fff{ public static void main(String[] args){ for(int i=1;i++){ for(int j=1;j++){ System.out.print(j+"*"+i+"="+9j*i)+" "); } System.out.println(); } }
public class fff { public static void main(String[] args) { int allday = 0; int[] days = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; System.out.print("请输入年月日:"); String dateStr = read.next(); String[] dateInt = dateStr.split("/"); int year = Integer.parseInt(dateInt[0]); int month = Integer.parseInt(dateInt[1]); int day = Integer.parseInt(dateInt[2]); for (int i = 0; i < month - 1; i++) { allday += days[i]; } allday += day; if ((((year % 4 == 0 && year % 100 == 0) || year % 400 == 0) && month > 2)) { allday++; } System.out.println(month + "月" + day + "是" + year + "年的第" + allday + "天"); } }
public class fff { public static void main(String[] args) { System.out.println("请输入一个整数:"); int num=sc.nextInt(); int result=0; while(true) { int n=num%10; result=result*10+n; num=num/10; if(num==0) { break; } } System.out.println(result); } }