if else编程练习

输入一个字符,判断它是否为大写字母,如果是,将它转换成小写字母,如果不是,不转换,然后输出最后得到的字符

值得注意的是,在ASCLL码表中

大写字母的区间是65~90

小写字母的区间是97~122


if函数的嵌套

注意的是if和else的位置要一一对应,这样就不容易出错,也可以让我们的编程思路更加简洁明了

#include<stdio.h>
int main()
{
	int money,handsome,health,will;
	printf("are you health?Yes set 1,Not set 0\n");
	scanf("%d",&health);
	if(health==1){
		printf("do you have money and handsome?Yes set 1,Not set 0\n");
		scanf("%d%d",&money,&handsome);
		if(money==1&&handsome==1){
			printf("do you will give me money?Yes set 1,Not set 0\n");
			scanf("%d",&will);
			if(will==1){
				printf("yes,i want you!\n");
			}else{
				printf("sorry,get out ");
			} 
		}else{
			printf("sorry,i want both of its man\n");
		}
	}else{
		printf("sorry,i need a health man\n");
	}
	return 0;
}

  • 3
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值