当前位置:网站首页>电子协会 C语言 1级 33 、奇偶数判断
电子协会 C语言 1级 33 、奇偶数判断
2022-07-02 01:29:00 【dllglvzhenfeng】
电子协会 C语言 1级 33 、奇偶数判断
C++代码:方法一
/*
电子协会 C语言 1级 33 、奇偶数判断 方法一
http://noi.openjudge.cn/ch0104/03/
给定一个整数,判断该数是奇数还是偶数。
输入
输入仅一行,一个大于零的正整数 n。
输出
输出仅一行,如果 n 是奇数,输出 odd;如果 n 是偶数,输出 even。
样例输入
5
样例输出
odd
*/
#include<iostream>
using namespace std;
int main()
{
int n;
cin>>n;
( n%2 == 0 ) ? cout<<"even" : cout<<"odd" ;
//cout<<int(3.5);
return 0;
}C++代码:方法二
/*
电子协会 C语言 1级 33 、奇偶数判断 方法二
http://noi.openjudge.cn/ch0104/03/
给定一个整数,判断该数是奇数还是偶数。
输入
输入仅一行,一个大于零的正整数 n。
输出
输出仅一行,如果 n 是奇数,输出 odd;如果 n 是偶数,输出 even。
样例输入
5
样例输出
odd
*/
#include<iostream>
using namespace std;
int main(void)
{
int x;
cin>>x;
if( x%2==1)
{
cout<<"odd"<<endl;
}
else
{
cout<<"even"<<endl;
}
return 0;
}C代码:
#include <stdio.h>
#include <stdlib.h>
int main()
{
int a;
scanf("%d",&a);
if(a%2==0) printf("even");
else printf("odd");
//system("pause");
return 0;
}python3代码:
n = int(input())
if n % 2:
print("odd")
else:
print("even")NOIP初赛 CSP-J1 CSP-S1 第1轮 初赛 信奥中的数学知识(一)
NOIP初赛 CSP-J1 CSP-S1 第1轮 初赛 信奥中的数学知识(一)_dllglvzhenfeng的博客-CSDN博客
NOIP初赛 CSP-J1 CSP-S1 第1轮 初赛 信奥中的数学知识(二)
NOIP初赛 CSP-J1 CSP-S1 第1轮 初赛 信奥中的数学知识(二)_dllglvzhenfeng的博客-CSDN博客
NOIP初赛 CSP-J1 CSP-S1 第1轮 初赛 信奥中的数学知识(三)
NOIP初赛 CSP-J1 CSP-S1 第1轮 初赛 信奥中的数学知识(三)_dllglvzhenfeng的博客-CSDN博客
2022年 CSP-J1 CSP-S1 初赛 如何进行复习 如何做题
2022年 CSP-J1 CSP-S1 初赛 如何进行复习 如何做题_dllglvzhenfeng的博客-CSDN博客
2021 CSP-J1 CSP-S1 第1轮 初赛 最后一周的计划(2021.09.15)
2021 CSP-J1 CSP-S1 第1轮 初赛 最后一周的计划(2021.09.15)_dllglvzhenfeng的博客-CSDN博客
2021CSP-J1初赛答案与讲评
2021CSP-J1初赛答案与讲评_以太以北的博客-CSDN博客
2022年暑期及9月份CSP-J1 CSP-S1初赛 培训计划及学习要点
2022年暑期及9月份CSP-J1 CSP-S1初赛 培训计划及学习要点_dllglvzhenfeng的博客-CSDN博客
NOIP普及组2006-2018初赛 2019 CSP-J1 2020 CSP-J1 完善程序题
NOIP普及组2006-2018初赛 2019 CSP-J1 2020 CSP-J1 完善程序题_dllglvzhenfeng的博客-CSDN博客
NOIP2006-2018 提高组 初赛试题完善程序题 CSP-S 2019 2020 初赛试题完善程序题
NOIP2006-2018 提高组 初赛试题完善程序题 CSP-S 2019 2020 初赛试题完善程序题_dllglvzhenfeng的博客-CSDN博客
边栏推荐
- [image enhancement] vascular image enhancement based on frangi filter with matlab code
- The author is more willing to regard industrial Internet as a concept much richer than consumer Internet
- Modeling essays series 124 a simple coding method
- The concept and application of Cartland number
- [WesternCTF2018]shrine writeup
- Bat Android Engineer interview process analysis + restore the most authentic and complete first-line company interview questions
- No converter found for return value of type: class
- No converter found for return value of type: class
- 6-3 vulnerability exploitation SSH environment construction
- ACM tutorial - quick sort (regular + tail recursion + random benchmark)
猜你喜欢

Learning note 3 -- Key Technologies of high-precision map (Part 1)

Docker installing Oracle_ 11g

Data visualization in medical and healthcare applications

Memorabilia of domestic database in June 2022
![[Floyd] post disaster reconstruction](/img/7a/f72c7781ef148212c870a56fb9a607.jpg)
[Floyd] post disaster reconstruction

机器学习基本概念

Study note 2 -- definition and value of high-precision map
![[rust web rokcet Series 1] Hello, world and get, post, put, delete](/img/d8/7dd5fe409d349a13128b6af554f952.jpg)
[rust web rokcet Series 1] Hello, world and get, post, put, delete

KS006基于SSM实现学生成绩管理系统

学习笔记2--高精度地图定义及价值
随机推荐
Architecture evolution from MVC to DDD
[IVX junior engineer training course 10 papers] 04 canvas and a group photo of IVX and me
Learn C language from scratch day 025 (maze)
ECS project deployment
Single chip microcomputer -- hlk-w801 transplant NES simulator (III)
迁移云计算工作负载的四个基本策略
【疾病检测】基于BP神经网络实现肺癌检测系统含GUI界面
学习笔记25--多传感器前融合技术
Edge computing accelerates live video scenes: clearer, smoother, and more real-time
SAP ui5 beginner tutorial XXI - trial version of custom formatter of SAP ui5
ES6 new method of string
卷積神經網絡(包含代碼與相應圖解)
Datawhale community blackboard newspaper (issue 1)
关于ASP.NET CORE使用DateTime日期类型参数的一个小细节
[image enhancement] vascular image enhancement based on frangi filter with matlab code
ACM tutorial - quick sort (regular + tail recursion + random benchmark)
Game thinking 15: thinking about the whole region and sub region Services
卷积神经网络(包含代码与相应图解)
Feature extraction and detection 16 brisk feature detection and matching
II Basic structure of radio energy transmission system