C语言利用自定义函数求面积

/**********************
时间: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");
}
知识点:学会构建函数,学会模块化的思想
发布了16 篇原创文章 · 获赞 0 · 访问量 1572

猜你喜欢

转载自blog.csdn.net/weixin_45713352/article/details/104695963