Java程序查找矩形区域
矩形的面积是其长度和宽度的乘积。因此,要计算一个矩形的面积
获取用户形成的矩形的长度。
获取用户矩形的宽度。
计算他们的乘积。
打印产品。
示例
import java.util.Scanner;
public class AreaOfRectangle {
public static void main(String args[]){
int length, breadth, area;
Scanner sc = new Scanner(System.in);
System.out.println("Enter the length of the rectangle ::");
length = sc.nextInt();
System.out.println("Enter the breadth of the rectangle ::");
breadth = sc.nextInt();
area = length* breadth;
System.out.println("Area of the rectangle is ::"+area);
}
}输出结果
Enter the length of the rectangle :: 56 Enter the breadth of the rectangle :: 48 Area of the rectangle is ::2688
热门推荐
3 祝福语简短的微信
10 幼儿祝福语大全简短贺卡
11 感谢教官文案祝福语简短
12 鼠年同事祝福语简短创意
13 元旦祝福语 简短独特群发
14 妈咪跟我生日祝福语简短
15 给儿子新婚祝福语简短
16 伴娘祝福语长文案简短
17 恭喜高考完祝福语简短
18 生日祝福语送老公简短