標題:
五則運算 (三)
[打印本頁]
作者:
tonyh
時間:
2012-7-28 16:49
標題:
五則運算 (三)
本帖最後由 tonyh 於 2012-7-28 17:02 編輯
宣告整數變數x與y, 再將值代入做五則運算.
public class ch4
{
public static void main(String args[])
{
int x=10, y=5;
System.out.println("當x的值為"+x+", y的值為"+y+"時");
System.out.println("x+y="+(x+y));
System.out.println("x-y="+(x-y));
System.out.println("x*y="+(x*y));
System.out.println("x/y="+(x/y));
System.out.println("x%y="+(x%y));
}
}
複製代碼
作者:
t2364705
時間:
2012-7-28 16:58
public class ch4
{
public static void main(String args[])
{
int x=10, y=5;
System.out.println("當x的值為"+x+", y的值為"+y+"時");
System.out.println("x+y="+(x+y));
System.out.println("x-y="+(x-y));
System.out.println("x*y="+(x*y));
System.out.println("x/y="+(x/y));
System.out.println("x%y="+(x%y));
}
}
複製代碼
作者:
t3742238
時間:
2012-7-28 17:00
public class ch4
{
public static void main(String args[])
{ int x=10, y=5;
System.out.println("當X的值為"+x+",Y的值為"+y);
System.out.println("x+y="+(x+y));
System.out.println("x-y="+(x-y));
System.out.println("x*y="+(x*y));
System.out.println("x/y="+(x/y));
System.out.println("x%y="+(x%y));
}
}
複製代碼
作者:
尤泓鈞
時間:
2012-7-28 17:01
public class ch4
{
public static void main(String args[])
{
int x=10, y=5;
System.out.println("當x的值為"+x+", y的值為"+y+"時");
System.out.println("x+y="+(x+y));
System.out.println("x-y="+(x-y));
System.out.println("x*y="+(x*y));
System.out.println("x/y="+(x/y));
System.out.println("x%y="+(x%y));
}
}
複製代碼
作者:
蔡昀佑
時間:
2012-7-28 17:03
public class ch4
{
public static void main(String args[])
{
int x=10, y=5;
System.out.println("當x的值為"+x+", y的值為"+y+"時");
System.out.println("x+y="+(x+y));
System.out.println("x-y="+(x-y));
System.out.println("x*y="+(x*y));
System.out.println("x/y="+(x/y));
System.out.println("x%y="+(x%y));
}
}
複製代碼
作者:
劉漢文
時間:
2012-8-7 15:44
public class ch4
{
public static void main(String args[])
{
int x=10, y=5;
System.out.println("當x的值為"+x+", y的值為"+y+"時");
System.out.println("x+y="+(x+y));
System.out.println("x-y="+(x-y));
System.out.println("x*y="+(x*y));
System.out.println("x/y="+(x/y));
System.out.println("x%y="+(x%y));
}
}
複製代碼
作者:
粘靖瑜
時間:
2012-8-10 11:26
public class ch4
{
public static void main(String arg[])
{
int x=10, y=5;
System.out.println("當x的值為"+x+", y的值為"+y+"時...");
System.out.println("x+y="+(x+y));
System.out.println("x-y="+(x-y));
System.out.println("x*y="+(x*y));
System.out.println("x/y="+(x/y));
System.out.println("x%y="+(x%y));
}
}
複製代碼
作者:
黃博鴻
時間:
2012-10-6 14:41
public class ch4
{
public static void main(String args[])
{
int x=15, y=20;
System.out.println("當x的值為"+x+",y的值為"+y+"時");
System.out.println("x+y="+(x+y));
System.out.println("x-y="+(x-y));
System.out.println("x*y="+(x*y));
System.out.println("x/y="+(x/y));
System.out.println("x%y="+(x%y));
}
}
複製代碼
歡迎光臨 種子論壇 | 高雄市資訊培育協會學員討論區 (http://seed.istak.org.tw/)
Powered by Discuz! 7.2