编写程序求矩形的面积和周长,矩形的长和宽由键盘输入

用vc6.0编辑
2024-11-29 17:44:21
推荐回答(3个)
回答1:

#include
void main()
{ float l,w;
float area,girth;
printf("please input length and width of the rectangle\n");
scanf("%f%f",&l,&w);
area=(l*w);
girth=(2*(l+w));
printf("area=%f,girth=%f\n",area,girth);
}

回答2:

#include
main()
{
int chang,int kuang;
int zhouchang,mianji;
printf("please Enter chang and kuang:");
scanf("%d,%d",&chang,&kuang);
zhouchang=2*(chang+kuang);
mianji=chang*kuang;
printf("zhouchang=%d\n,mianji=%d\n",zhouchang,mianji);
}
说明:输入长和宽中间用空格隔开

回答3:

用java编写一个 很简单啊