当前位置: 首页 > >

两个.java_两个java程序加和

发布时间:

第一个:importjava.util.Scanner;publicclassTest{publicstaticvoidmain(String[]args){Scanners=newScanner(System.in);System.out.println("Pleaseenter...");Stringname=s.next()...


第一个:import java.util.Scanner;


public class Test {


public static void main(String[] args) {


Scanner s = new Scanner(System.in);


System.out.println("Please enter...");


String name = s.next();


String studentId = s.next();


String specialty = s.next();


System.out.println("姓名:"+name+",学号:"+studentId+" ,专业: "+specialty);


}


}


第二个


import java.util.Scanner;


class abc


{ public static void main(String arg[]){


Scanner input=new Scanner (System.in);


System.out.println("请输入a、b的值:");


System.out.print("a=");


float a =input.nextInt();


System.out.print("b=");


float b =input.nextInt();


float 差;


差=a-b;


float 和;


和=a+b;


float 积;


积=a*b;


float 商;


商=a/b;


System.out.println("差="+差);


System.out.println("和="+和);


System.out.println("积="+积);


System.out.println("商="+商);


}


}


展开







相关资源:18款表白网页源代码(表白)



友情链接: