标签:main can 程序 一个 知识 字母 数据 pack img
1、已知a,b均是整型变量,写出将a,b两个变量中的值互换的程序。(知识点:变量和 运算符综合应用)
package huaerzi; public class huada { public static void main(String[] args) { //TODO AUto-generated method stub int a=100; int b=200; int tmp; //数据交换 tmp=a; a=b; b=tmp; System.out.println("交换后的a:"+a+",b;"+b); }
package huaerzi; import java.util.Scanner; public class huada { public static void main(String[] args) { //TODO AUto-generated method stub int a=457,ge,shi,bai,he; ge=a%10; shi=a/10%10; bai=a/100; he=ge+shi+bai; System.out.println("三位数和为"+he); } }
package huaerzi; import java.util.Scanner; public class huada { public static void main(String[] args) { //TODO AUto-generated method stub Scanner reader=new Scanner(System.in); int h=0; System.out.println("输入华温度:"); h=reader.nextInt(); double s=(double)5*(h-32)/9; System.out.print("华温度"+h+"对应摄氏度为:"); System.out.printf("%4.2f",s); } }
package huaerzi; import java.util.Scanner; public class huada { public static void main(String[] args) { //TODO AUto-generated method stub char a=‘A‘; System.out.println((char)(a + 32)); } }
标签:main can 程序 一个 知识 字母 数据 pack img
原文地址:https://www.cnblogs.com/reddead/p/12523160.html