當前位置:編程學習大全網 - 電腦編程 - 求C語言編程矩形面積周長對角線

求C語言編程矩形面積周長對角線

#include "stdio.h"

//面積

double area(double len,double wid){return len*wid;}

//周長

double circle(double len,double wid){return 2*(len+wid);}

//對角線

double duijiaoxian(double len,double wid){return sqrt(len*len+wid*wid);}

void main()

{

printf("請輸入長寬:\n");

double length,width;

scanf("%f%f",&length,&width);

printf("面積為:\n",area(length,width));

printf("周長為:\n",circle(length,width));

printf("對角線長為:\n",duijiaoxian(length,width));

}

  • 上一篇:人工進料皮帶機遠控是什麽意思?在PLC中如何編程
  • 下一篇:深圳市匯川技術股份有限公司是外包嗎
  • copyright 2024編程學習大全網