一、
Scanner input =new Scanner(System.in);
System.out.println("输入交换前a,b的值");
int a=input.nextInt();
int b=input.nextInt();
int c;
System.out.println("a="+a+"\t"+"b="+b+"\t");
c=a;
a=b;
b=c;
System.out.println("a="+a+"\t"+"b="+b+"\t");
}
}
二、
Scanner input =new Scanner(System.in);
System.out.println("输入两个数a,b的值");
int a=input.nextInt();
int b=input.nextInt();
System.out.println(a*a+b*b);
}
}
三、
Scanner input=new Scanner(System.in);
System.out.println("商品单价");
double prise=input.nextDouble();
System.out.println("商品数量");
double number=input.nextDouble();
System.out.println("商品总价为");
double allprise=prise*number;
System.out.println(allprise);
System.out.println("八折活动价抹零后为");
System.out.println(allprise*0.8-allprise*0.8%1);
System.out.println("付款金额为");
double money=input.nextDouble();
System.out.println("找零为");
System.out.println(money-(allprise*0.8-allprise*0.8%1));
}
}
四、
Scanner input = new Scanner(System.in);
System.out.println("输入一个三位数");
int num = input.nextInt();
int ge = num % 10;
System.out.println("个位是" + ge);
int shi = num / 10 % 10;
System.out.println("十位是" + shi);
int bai = num / 100;
System.out.println("百位是" + bai);
}
}
五、
Scanner input =new Scanner(System.in);
System.out.println("任意输入一个大写字母");
String m=input.next();
char n;
n=m.charAt(0);
System.out.println((char)(n+32));
}
}
六、
Scanner input = new Scanner(System.in);
System.out.println("输入两个数");
int a = input.nextInt();
int b = input.nextInt();
int max=a>b?a:b;
System.out.println("输出较大数"+max);
}
}