/********************** 時間:20200306 功能:利用函數求長方形面積 做者:袁歡 地點:國防大學 *********************/ #include<stdio.h> #include<stdlib.h> float area(float a, float b)//定義函數 { float s; s = a*b; return (s); } int main() { float x, y,s; scanf_s("%f %f", &x, &y); s = area(x, y); printf("面積=%.2f", s); system("pause"); } 知識點:學會構建函數,學會模塊化的思想