บทที่ 5 การเขียนโปรแกรมให้คำนวนตัวเลข
class Oper {
 public static void main (String[] args) {
  // +, -, *, /, %
  int x = 10;
  int y = 3;
  int z = (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));
  System.out.println("x%y= " +(x%y));
 }
}
/* ในบทนี้เป็นการใช้ตัวดำเนินการทางคณิตศาสตร์ 
หรือที่เรียกว่า Operators
 
 
 
          
      
 
  
 
 
 
 
 
 
 
 
 
 
ไม่มีความคิดเห็น:
แสดงความคิดเห็น