A - Two Rectangles AtCoder-2284

本文介绍了一个简单的程序设计问题——比较两个矩形的面积大小,并给出了一段C语言代码实现。该程序接收四个整数输入,分别代表两个矩形的长和宽,然后输出面积较大的矩形的面积。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

          A - Two Rectangles

There are two rectangles. The lengths of the vertical sides of the first rectangle are A, and the lengths of the horizontal sides of the first rectangle are B. The lengths of the vertical sides of the second rectangle are C, and the lengths of the horizontal sides of the second rectangle are D.

Print the area of the rectangle with the larger area. If the two rectangles have equal areas, print that area.

Constraints

  • All input values are integers.
  • 1A104
  • 1B104
  • 1C104
  • 1D104
Input

The input is given from Standard Input in the following format:

A B C D
Output

Print the area of the rectangle with the larger area. If the two rectangles have equal areas, print that area.

Sample Input 1

3 5 2 7
Sample Output 1

15

The first rectangle has an area of 3×5=15, and the second rectangle has an area of 2×7=14. Thus, the output should be 15, the larger area.

Sample Input 2

100 600 200 300
Sample Output 2

60000


AC代码:
                  Select Code

#include<stdio.h>
int main()
{
	int a,b,c,d,s1,s2;
	scanf("%d%d%d%d",&a,&b,&c,&d);
	s1=a*b;
	s2=c*d;
	if(s1>=s2)
	  printf("%d\n",s1);
	else
	  printf("%d\n",s2);
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值