zoukankan      html  css  js  c++  java
  • 第一次上机作业

    1、已知a,b均是整型变量,写出将a,b两个变量中的值互换的程序。(知识点:变量和 运算符综合应用) 
    package
    first; public class one { public static void main(String[] args) { // TODO Auto-generated method stub int a=1; int b=2; int c=a; a=b; b=c; System.out.println("交换后a的值:"+a); System.out.println("交换后b的值:"+b); }

    给定一个0~1000的整数,求各位数的和,

    import java.util.Scanner;
    
    public class one {
    
        public static void main(String[] args) {
            // TODO Auto-generated method stub
            int a = 1234;
            int b, c, d, e, sum;
            e = a/ 1000;
            b = a/ 100 % 10;
            c = a / 10 % 10;
            d = a % 10;
            sum = b +c +d +e ;
            System.out.println("结果为"+sum);
        }
            

    华氏度50转成摄氏度是多少???

    package first;
    
    public class one {
    
        public static void main(String[] args) {
            // TODO Auto-generated method stub
            //定义一个华氏度
            int a=50;
            //定义一个摄氏度
            int b=(a-32)*5/9;
            System.out.println("摄氏度="+b);
        }
    
    }

    给定一个任意的大写字母A~Z,转换为小写字母。

    package first;
    
    public class one {
    
        public static void main(String[] args) {
            // TODO Auto-generated method stub
            char a = 'A';
            System.out.println((char)(a + 32)); 
        }
    
    }

  • 相关阅读:
    select top 变量问题
    distinct top執行順序
    Subquery typo with using in(转)
    sql:查询课程号'0312091006'成绩排名第5到第10之间的学生学号
    case when then
    触发器
    索引
    管理事物处理
    053345
    053344
  • 原文地址:https://www.cnblogs.com/Inati/p/12523725.html
Copyright © 2011-2022 走看看