知道長方形的長和寬,求面積和周長
#include
main()
{
float x,y,a,b;
printf ("請輸入長和寬且用逗號分隔:);
scanf ("%f,%f,&x,&y);
a=x*y;
b=(x+y)*2;
printf ("面積=%f,周長=%f\n",a,b);
}
#include <stdio.h>
main()
{
float x,y,a,b;
printf("Please input length and width of rectangle with comma divided:");
scanf("%f,%f",&x,&y);
a = x * y;
b = ( x + y ) * 2;
printf(" area = %f, girth = %f", a, b);