int main()
{
//calculate the perimeter and area
printf("insert a and b,divide them by space");
float a,b;
scanf("%f %f",&a,&b);
printf("the area is%f and the perimemeter is%f",a*b,2*(a+b));
}
int main()
{
//计算并联电阻
printf("insert the R1 R2");
float R1,R2;
scanf("%f %f",&R1,&R2);
printf("并联的电阻是:%f",R1*R2/(R1+R2));
}
int main()
{
//摄氏温度转℉
printf("insert the Celsuis:");
float Fahr,Celsuis;
scanf("%f",&Celsuis);
Fahr=Celsuis*9.0/5.0+32.0;
printf("华氏温度是:%f",Fahr);
}
#include <stdio.h>
#include <stdlib.h>
#define pi 3.1415926
int main()
{
//计算圆柱表面积
printf("输入圆柱的半径r和高h:\n例如:3.5 9\nArea=274.889\n");
float s,r,h;
scanf("%f %f",&r,&h);
s=r*r*2*pi+h*2*pi*r;
printf("Area=%f",s);
}
int main(){ //calculate the perimeter and area printf("insert a and b,divide them by space"); float a,b; scanf("%f %f",&a,&b); printf("the area is%f and the perimemeter is%f",a*b,2*(a+b));}