♠ Posted by Unknown in Core Java,IGNOU MCA Practicals at 22:06
IGNOU - MCSL025 - SECTION04 - [S01_E01]
/* Author: Viral Vyas
* Write a program in Java to implement the formula (Area = Height * Width) to
* find the area of a rectangle. Where Height and Width are the rectangle's
* height and width.
*/
package mcsl025;
import java.io.*;
import java.lang.*;
public class S01E01 {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(
new InputStreamReader(System.in));
System.out.println("Enter Value for RECTANGLE....");
System.out.print("Height : ");
double h = Double.parseDouble(br.readLine());
System.out.print("Width : ");
double w = Double.parseDouble(br.readLine());
double area = h * w;
System.out.println("The Area is : " + area);
}
}
Output:
Enter Value for RECTANGLE....
Height : 5
Width : 6
The Area is : 30.0
0 comments:
Post a Comment