已知 a,b均是整型变量,写出将 a,b两个变量中的值互换的程序 package demo3; public class day01 { public static void main(String[] args) { int a,b,c; a=1; b=2; c=a; a=b; b=c; System.out.println(a); System.out.println(b); // TODO Auto-generated method stub } }
给定一个100-1000的整数,求各位数的和 public class day01 { public static void main(String[] args) { int a,b,c,f,d; a=123; b=(a%10); c=(a/10%10); f=(a/100); System.out.println(b); System.out.println(c); System.out.println(f); System.out.println(b+c+f); // TODO Auto-generated method stub } }
设置四个变量分别代表华氏度,摄氏度,另一个代表转换之后的温度 public class day01 { public static void main(String[] args) { int a,b,c,f; a=70; b=33; c=(a-32)*5/9; a=c; f=b*9/5+32; b=f; System.out.println(c); System.out.println(f); // TODO Auto-generated method stub } }
给定一个任意的大写字母A-Z,转换为小写字母 public class day01 { public static void main(String[] args) { /*int a,b,c,f; a=70; b=33; c=(a-32)*5/9; a=c; f=b*9/5+32; b=f; System.out.println(c); System.out.println(f); // TODO Auto-generated method stub*/ char c='H'; System.out.println((char)(c+32)); } }