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

[C语言]题集3(基础)

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

[C语言]题集3(基础)

作者简介:大家好,我是泽奀。全栈领域新星创作者磊作者周榜:44 ✨  

个人主页:weixin_52632755的博客_泽奀_CSDN博客

点赞➕评论➕收藏 == 养成习惯

这个系列C语言题集每次我都会出五道题,大家有兴趣可以做下,都是比较基础的。

第十一题:描述:将字符串小写字母转换成大写字母

toupper 作用:把小写字母转换为大写字母,如果参数c不是小写字母就不转换裡

包含的头文件:#include

第十二题:描述:输入三个数字,从大到小依次的进行排列✅

第十三题:描述:实现一个函数,打印乘法口诀表,口诀表的行列数自己指定

第十四题:描述:有1、2、3、4个数字,能组成多少个互不相同且无重复的三位数,都是多少?并且把组成的数的总数给打印出来

第十五题:描述:递归实现N的阶乘计算✅

目录

✨第十一题代码:

✨第十二题代码:

✨第十三题代码:

✨第十四题代码:

✨第十五题代码:

第十一题代码:
#include
#include
int main(void)
{
	char arr[20] = "hello Cyuyan";
	printf("打印前:%sn", arr);
	printf("********************n");
	int i;
	int sz = sizeof(arr) / sizeof(arr[0]);
	for (i = 0; i < sz; i++)
	{
		arr[i] = toupper(arr[i]);
	}
	printf("打印后:%sn", arr);
}

第十二题代码:
#include
int main(void)
{
	int a = 0;
	int b = 0;
	int c = 0;
	int temp = 0;
	printf("请输入3个数的值: ");
	scanf("%d %d %d", &a, &b, &c);
	if (a < b)
	{
		int temp = a;
		a = b;
		b = temp;
	}
	if (a < c)
	{
		int temp = a;
		a = c;
		c = temp;
	}
	if (b < c)
	{
		int temp = b;
		b = c;
		c = temp;
	}
	printf("%d %d %dn", a, b, c);

	return 0;
}

第十三题代码:
#include
void print_arbitrarily(int number)
{
	int i = 0;
	for (i = 1; i <= number; i++)
	{
		int j = 0;
		for (j = 1; j <= i; j++)
		{
			printf("%d*%d=%2d ", i, j, i*j);
		}
		printf("n");
	}
}
int main(void)
{
	int number = 0;
	printf("请输入数字:");
	scanf_s("%d", &number);
	//调用函数
	print_arbitrarily(number);

	return 0;
}

第十四题代码:
#include
int main(void)
{
	int a, b, c;
	int Count = 0;
	for (a = 1; a<5; a++)
		for (b = 1; b<5; b++)
			for (c = 1; c<5; c++)
				if (a != b && a != c && b != c)
				{
					printf("%d%d%d ", a, b, c);
					Count = Count + 1;
				}
	printf("n");
	printf("Count = %d", Count);
	return 0;
}

第十五题代码:
#include
int face(int n)
{
	if (n <= 1)
		return 1;
	else
		return n*face(n - 1);
}
int main(void)
{
	int n;
	printf("请输入你的数字:");
	scanf_s("%d", &n);
	int ret = face(n);
	printf("%dn", ret);
}

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

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

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