栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > C/C++/C#

c语言基本运算训练

C/C++/C# 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

c语言基本运算训练

1.求三角形面积

#include
#include
int main()
{
	double a,b,c,s,area;
	a=3.67;
	b=5.43;
	c=6.21;
	s=(a+b+c)/2;
	area=sqrt(s*(s-a)*(s-b)*(s-c));
	printf("a=%ftb=%ftc=%ft");
	printf("area=%fn");
	return 0;
 } 

运行结果

a=0.000000      b=0.000000      c=-1.#QNAN0     area=0.000000

--------------------------------
Process exited after 0.0094 seconds with return value 0
请按任意键继续. . .

2.输入球半径,求球体积

#include
#include
#define PI 3.14
int main()
{
	float r,v;
	printf("请输入半径r:");
	scanf("%f",&r);
	v=4*PI*pow(r,3)/3;
	printf("%f",v);
	return 0; 
 } 

运行结果

请输入半径r:3
113.040001
--------------------------------
Process exited after 3.564 seconds with return value 0
请按任意键继续. . .

3.字母的大写转小写

#include
int main()
{
	char c1,c2;
	c1='A';
	c2=c1+32;
	printf("%c,%cn",c1,c2);
	printf("%d,%dn",c1,c2);
	return 0; 
}

运行结果

A,a
65,97

--------------------------------
Process exited after 0.01597 seconds with return value 0
请按任意键继续. . .

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/784153.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号