3124:练21.1 年龄段判断(C、C++、python)

3124:练21.1  年龄段判断

信息学奥赛一本通-编程启蒙(C++版)在线评测系统

练21.1 年龄段判断

信息学奥赛一本通-编程启蒙(C++版)在线评测系统



C语言源码:

#include <stdio.h> 
#include <stdlib.h>
int main()
{
	int n;
	
	scanf("%d",&n);

	if( n<=3 )
	{
		printf("infant\n");
	}
	else
	{
		if( n<=12 )
		{
			printf("child\n");
		}
		else
		{
			if( n<=18 )
			{
				printf("youngster\n");
			}
			else
			{
				printf("youth\n");
			}
		}
	}
    
    return 0;
}



C++程序:

#include<iostream>
using namespace std;
int main(){
	int n;
	cin>>n;
	if(n>=0&&n<=3){
		cout<<"infant";
	}
	else if(n>=4&&n<=12){
		cout<<"child";
	}	
	else if(n>=13&&n<=18){
		cout<<"youngster";
	}	
	else{
		cout<<"youth";
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	
	if( n<=3 )
	{
		cout<<"infant"<<endl;
	}
	else
	{
		if( n<=12 )
		{
			cout<<"child"<<endl;
		}
		else
		{
			if( n<=18 )
			{
				cout<<"youngster"<<endl;
			}
			else
			{
				cout<<"youth"<<endl;
			}
		}
	}
    
    return 0;
}


python3代码:

n=int(input())
if 0 <= n and n <= 3:
            print("infant")
else:
            if 4 <= n and n <= 12:
                        print("child")
            else:
                        if  13 <= n and n <= 18:
                                    print("youngster")
                        else:
                                    print("youth")


a=int(input())

if 0<=a and a<=3:
    print("infant")
else:
    if 4<=a and a<=12:
        print("child")
    else:
        if 13<=a and a<=18:
            print("youngster")
        else:
            print("youth")



 




蓝桥杯青少创意编程python组

蓝桥杯青少创意编程python组_2019年12月份 python 蓝桥杯青少组-CSDN博客

Python相关的考试和认证

Python相关的考试和认证_python考级官网-CSDN博客

python刷题 NOI题库 python题解 洛谷、牛客网、AcWing 刷题等

python刷题 NOI题库 python题解 洛谷、牛客网、AcWing 刷题等_acwing和洛谷哪个好-CSDN博客

Python信息技术学考一本通题目讲解、python入门、python习题集整理汇总等

Python信息技术学考一本通题目讲解、python入门、python习题集整理汇总等_信息学奥赛一本通python网站-CSDN博客

python画图系列整理

python画图系列整理_python画图作品-CSDN博客

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

dllglvzhenfeng

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值