用c语言写一个计算长方形面积的代码
时间: 2023-04-01 17:03:50 浏览: 108
您好,以下是计算长方形面积的 C 语言代码:
#include <stdio.h>
int main() {
float length, width, area;
printf("请输入长方形的长度:");
scanf("%f", &length);
printf("请输入长方形的宽度:");
scanf("%f", &width);
area = length * width;
printf("长方形的面积为:%.2f\n", area);
return ;
}
相关问题
用C语言编写计算长方形面积的代码
可以使用以下代码来计算长方形的面积:
#include <stdio.h>
int main() {
float length, width, area;
printf("请输入长方形的长度和宽度:\n");
scanf("%f %f", &length, &width);
area = length * width;
printf("长方形的面积为:%.2f\n", area);
return ;
}
编辑一个C语言,计算长方形的面积
可以使用以下代码计算长方形的面积:
#include <stdio.h>
int main() {
float length, width, area;
printf("请输入长方形的长度:");
scanf("%f", &length);
printf("请输入长方形的宽度:");
scanf("%f", &width);
area = length * width;
printf("长方形的面积为:%f\n", area);
return ;
}
相关推荐
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)