package chap1;
public class test1009 {
public static void main(String args[]) {
String S1="國文",S2="英文",S3="日文",S4="數學",S5="自然",S6="體育";
int chi, eng, jap, mat, sci, PE, sum,avg; // int-integer整數,4位元組
String name ="李依靜",stuno="4020Q090";// 宣告變數;要求系統配置記憶體
chi = 75;
eng = 90;
jap = 95;
mat = 52;
sci = 61;
PE = 77;
sum = chi + eng + jap + mat + sci + PE; //累加
avg=sum/6;
System.out.println("姓名: "+name+ "學號 = "+ stuno+"總成績= "+"\'"+sum+"\'"+"\t"+"總平均\t"+avg); //字串串接
System.out.println("姓名:\t"+name+"\n"+"學號=\t"+stuno+"\n"+"總成績=\t"+sum);
System.out.println("\""+S1+"\""+"\t"+"\""+S2+"\""+"\t"+"\""+S3+"\""+"\t"+"\""+S4+"\""+"\t"+"\""+S5+"\""+"\t"+S6+"\""+"\t");
System.out.println("\'"+chi+"\'"+"\t"+"\'"+eng+"\'"+"\t"+"\'"+jap+"\'"+"\t"+"\'"+ mat+"\'"+"\t"+"\'"+sci+"\'"+"\t"+"\'"+PE+"\'"+"\t");
}
}
留言列表