编写一个C程序,从键盘上输入矩形的长和宽,屏幕上显示对应的矩形周长和面积

2024-12-04 11:00:57
推荐回答(3个)
回答(1):

#include

int main()
{
double a,b ;
cin>>a>>b ;
printf("S=%f,C=%f",a*b,(a+b)*2) ;
return 0 ;
}

回答(2):

#include
main()
{ double a,b,s,c;
scanf("%f%f",&a,&b);
printf("s=%f,c=%f\n",a*b,(a+b)*2) ;
}

回答(3):

#include
main()
{ double width,height,area,girth;
printf("Please Input height and width:")
scanf("%f%f",&height ,&width);
printf("area=%f,girth=%f\n",width*height ,(width+height )*2) ;
getch();
}