当前位置:网站首页>Electronic Association C language level 1 33, odd even number judgment
Electronic Association C language level 1 33, odd even number judgment
2022-07-02 01:33:00 【dllglvzhenfeng】
Electronics Association C Language 1 level 33 、 Odd even judgment
OpenJudge - 03: Odd even judgment
C++ Code : Method 1
/*
Electronics Association C Language 1 level 33 、 Odd even judgment Method 1
http://noi.openjudge.cn/ch0104/03/
Given an integer , Judge whether the number is odd or even .
Input
Enter only one line , A positive integer greater than zero n.
Output
Output only one line , If n Is odd , Output odd; If n It's even , Output even.
The sample input
5
Sample output
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++ Code : Method 2
/*
Electronics Association C Language 1 level 33 、 Odd even judgment Method 2
http://noi.openjudge.cn/ch0104/03/
Given an integer , Judge whether the number is odd or even .
Input
Enter only one line , A positive integer greater than zero n.
Output
Output only one line , If n Is odd , Output odd; If n It's even , Output even.
The sample input
5
Sample output
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 Code :
#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 Code :
n = int(input())
if n % 2:
print("odd")
else:
print("even")NOIP Preliminaries CSP-J1 CSP-S1 The first 1 round Preliminaries Mathematical knowledge in Xinao ( One )
NOIP Preliminaries CSP-J1 CSP-S1 The first 1 round Preliminaries Mathematical knowledge in Xinao ( Two )
NOIP Preliminaries CSP-J1 CSP-S1 The first 1 round Preliminaries Mathematical knowledge in Xinao ( 3、 ... and )
2022 year CSP-J1 CSP-S1 Preliminaries How to review How to write questions
2021 CSP-J1 CSP-S1 The first 1 round Preliminaries Plan for the last week (2021.09.15)
2021CSP-J1 Preliminary answers and comments
2021CSP-J1 Preliminary answers and comments _ Blog north of ether -CSDN Blog
2022 Summer vacation and 9 month CSP-J1 CSP-S1 Preliminaries Training plan and learning points
NOIP Popularization group 2006-2018 Preliminaries 2019 CSP-J1 2020 CSP-J1 Perfect the program problem
NOIP2006-2018 Improvement group Preliminary test questions perfect program questions CSP-S 2019 2020 Preliminary test questions perfect program questions
边栏推荐
- 卷积神经网络(包含代码与相应图解)
- Develop those things: how to use go singleton mode to ensure the security of high concurrency of streaming media?
- 人工智能在网络安全中的作用
- II Basic structure of radio energy transmission system
- ACM教程 - 快速排序(常规 + 尾递归 + 随机基准数)
- 基于SSM实现微博系统
- Docker安装Oracle_11g
- Edge computing accelerates live video scenes: clearer, smoother, and more real-time
- Datawhale community blackboard newspaper (issue 1)
- 学习笔记3--高精度地图关键技术(上)
猜你喜欢
![[IVX junior engineer training course 10 papers] 02 numerical binding and adaptive website production](/img/b7/aecb815ca9545981563a1e16cfa19e.jpg)
[IVX junior engineer training course 10 papers] 02 numerical binding and adaptive website production

The technology boss is ready, and the topic of position C is up to you

I'll teach you to visit Amazon RDS for a year and build a MySQL cloud database (only 10 minutes, really fragrant)

Liteos learning - first knowledge of development environment

Learning notes 25 - multi sensor front fusion technology

GL Studio 5 installation and experience

成功实现边缘编码需要了解的六大经验教训

Unity AssetBundle subcontracting

Leetcode, 3 repeatless longest subsequence

Another programmer "deleted the library and ran away", deleted the code of the retail platform, and was sentenced to 10 months
随机推荐
Have you stepped on the nine common pits in the e-commerce system?
The concept and application of Cartland number
Recommend an online interface mock tool usemock
MySQL application day02
6-3漏洞利用-SSH环境搭建
城市选择器组件实现原理
k线图形态这样记(口诀篇)
CTF daily question day45 sensor
Android high frequency network interview topic must know and be able to compare Android development environment
技术大佬准备就绪,话题C位由你决定
Shell Function
三分钟学会基础k线图知识
[WesternCTF2018]shrine writeup
卷積神經網絡(包含代碼與相應圖解)
[IVX junior engineer training course 10 papers to get certificates] 03 events and guessing numbers games
GL Studio 5 安装与体验
We should make clear the branch prediction
[IVX junior engineer training course 10 papers] 02 numerical binding and adaptive website production
How to compress video size while adding watermark with one click?
Sql--- related transactions