• 第五周上机作业


    package set;
    
    import java.util.Scanner;
    
    public class SKS {
    
    	public static void main(String[] args) {
    		// TODO Auto-generated method stub
    		   int a=100,b,c,d;
    		   while(a<1000){
    			   b=a%10;
    			   c=a%100/10;
    			   d=a/100;
    			   if(b*b*b+c*c*c+d*d*d==a) {
    				   System.out.println(a);
    			   }
    			   a++;
    		   }
    		   }
    		   
    		    
    	}
    

      

    package set;
    
    import java.util.Scanner;
    
    public class SKSK {
    
    	public static void main(String[] args) {
    		// TODO Auto-generated method stub
              Scanner input=new Scanner(System.in);
              int m =0;
              int y =0;
              int s =0;
              int a ;
              int d =0;
              System.out.println("请输入年");
              y=input.nextInt();
              System.out.println("请输入月");
              m=input.nextInt();
              System.out.println("请输入日");
              d=input.nextInt();
              switch(m) {
              case 1 :
            	  s=0;break;
              case 2:
            	  s=31;break;
              case 3 :
            	  s=59;break;
              case 4 :
            	  s=90;break;
              case 5 :
            	  s=120;break;
              case 6 :
            	  s=151;break;
              case 7 :
            	  s=181;break;
              case 8 :
            	  s=212;break;
              case 9 :
            	  s=243;break;
              case 10 :
            	  s=273;break;
              case 11 :
            	  s=304;break;
              case 12 :
            	  s=334;break;
            	  default:
             System.out.println("请输入年,月,日!"); break;}
               
                s=s+m;
            	 if(m>=0&&m<=12&&d>=1&&d<=31) {
            		 if(y%400==0||y%4==0&&y%100!=0) {
            			 a=1;
            		 }else {
            			 a=0;
            		 }
            		if(a==1&&m>2) {
            			s++;
            			System.out.println(y+"年"+m+"月"+d+"号是一年的低"+s+"天");
            		}
            		else { System.out.println(y+"年"+m+"月"+d+"号是一年的低"+s+"天");
            		}
            	 }      
              }      
    	}
    

      

    package set;
    
    import java.util.Scanner;
    
    public class SKSK {
    
    	public static void main(String[] args) {
    		// TODO Auto-generated method stub
              Scanner input=new Scanner(System.in);
              for(int a = 1;a <= 6;a++)
              {
                  for(int b = 1;b <= a;b++)
                      System.out.printf("%d ",b);
                  System.out.print("
    ");
              }
              System.out.print("
    ");
               
              for(int a = 6;a >= 1;a--)
              {
                  for(int b = 1;b <= b;b++)
                      System.out.printf("%d ",b);
                  System.out.print("
    ");
              }
              System.out.print("
    ");
               
              for(int a = 1;a <= 6;a++)
              {  
                  for(int b = 1;b <= 2 * (6 - a);b++)
                      System.out.print(" ");
                   
                  for(int b = a;b >= 1;b--)
                      System.out.printf("%d ",b);
                  System.out.print("
    ");
              }
              System.out.print("
    ");
               
              for(int a = 6;a >= 1;a--)
              {
                  for(int b = 1;b <= 2 *(6-a);b++)
                      System.out.print(" ");
                  for(int b = 1;b <= a;b++)
                      System.out.printf("%d ",b);
                  System.out.print("
    ");
              }
          }
    

      

    package set;
    
    import java.util.Scanner;
    
    public class SKSK {
    
    	public static void main(String[] args) {
    		// TODO Auto-generated method stub
              Scanner input=new Scanner(System.in);
              System.out.println("请输入一个四位数");
             int a =input.nextInt();
             int b;
            
             if(a>999&&a<=9999) {
            	 b=a/1000+a/100%10*10+a/10%10*100+a%10*1000;
            	 System.out.println(b);
             }else {
            	 System.out.println("请输入错误");
             }
          
    
    }
    	}
    

      

  • 相关阅读:
    Android NDK学习(1) 简介
    wmsys.wm_concat结果长度限制的问题
    onInterceptTouchEvent和onTouchEvent调用时序
    滑动到底部或顶部响应的ScrollView实现
    Android ViewPager使用详解
    android include标签的使用,在RelativeLayout中使用include标签需注意!!!!!
    Eclipse中如何在指定工程中搜索指定的字符串
    android:windowSoftInputMode属性详解
    cocos2d-x中关于touch事件的响应
    《从零开始学Swift》学习笔记(Day 6)——哎呀常量和变量都该什么时候用啊?
  • 原文地址:https://www.cnblogs.com/575757ljp--/p/12618974.html
Copyright © 2020-2023  润新知