Java第二次作业

public class qqq {

    /**
     * @param args
     */
    public static void main(String[] args) {
        // TODO Auto-generated method stub
        double r = 10;
        double area = 3.14 * r * r ;
        System.out.println("半径是3时,圆的面积是"+ area);
    }

}

 

 

2.

package ktlx;

public class lx2 {

    /**
     * @param args
     */
    public static void main(String[] args) {
        // TODO Auto-generated method stub
        double h1=50,s1;
        s1=(h1-32)*5/9;
        System.out.println(s1);
        double s2=30,h2;
        h2=s2*9/5+32;
        System.out.println(h2);
        

    }

}

 

 3.

package ktlx;

public class lx3 {

    /**
     * @param args
     */
    public static void main(String[] args) {
        // TODO Auto-generated method stub
        int a=5,b=8,c;
        c=a;
        a=b;
        b=c;
        System.out.println(a);
        System.out.println(b);
        
        

    }

 


 

4.

public class TestHello {

    /**
     * @param args
     */
    public static void main(String[] args) {
         int a=33333;
         System.out.println("a="+a);
         a=a/100*100;
         System.out.println("a="+a);
        // TODO Auto-generated method stub

    }

}

 

 5.

public class TestHello {

    /**
     * @param args
     */
    public static void main(String[] args) {
        int a=333;
        int ge=a%10;
        int shi=a%100/10;
        int bai=a%1000/100;
        int sum=ge+shi+bai;
        System.out.println(sum);
        // TODO Auto-generated method stub

    }

}

 

 6.

public class TestHello {

    /**
     * @param args
     */
    public static void main(String[] args) {
         char m='A';
         char n='f';
         System.out.println("m是"+m+"\t n是"+n);
         m=(char)(m+32);
         n=(char)(n-32);
         System.out.println("m是"+m+"\t n是"+n);
        // TODO Auto-generated method stub

    }

}

 

 

 
posted @ 2021-03-14 20:38  MaLD  阅读(37)  评论(0编辑  收藏  举报