แบบฝึกหัด 2
คำนวณหาพื้นที่ สี่เหลี่ยม...
import java.io.*;        
public class SqaurePerimeter            
{
      public static void main(String[] args) throws IOException               
    {  
         BufferedReader in = new BufferedReader(new InputStreamReader(System.in));  
        System.out.println("Input Square Width : ");                            
        String strWidth = in.readLine();                                      
        System.out.println("Input Square Length : ");                         
        String strLength = in.readLine();                                       
        double width = Double.parseDouble(strWidth);                           
        double length = Double.parseDouble(strLength);                
        double result =  2*(width+length);                               
        System.out.println("The Square Perimeter = "+result);                 
    }
}
 
ไม่มีความคิดเห็น:
แสดงความคิดเห็น