当前位置:网站首页>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
边栏推荐
- Matlab uses audioread and sound to read and play WAV files
- Architecture evolution from MVC to DDD
- Brief introduction to the development of mobile network
- No converter found for return value of type: class
- 学习笔记25--多传感器前融合技术
- The role of artificial intelligence in network security
- Leetcode 45 Jumping game II (2022.02.14)
- Shell Function
- Variables and constants of go language foundation
- ECS project deployment
猜你喜欢

Another programmer "deleted the library and ran away", deleted the code of the retail platform, and was sentenced to 10 months

Study note 2 -- definition and value of high-precision map

Android: how can golden nine and silver ten squeeze into the first-line big factories from small and medium-sized enterprises? The depth of interview questions in large factories

Design and control of multi rotor aircraft (VII) -- sensor calibration and measurement model
![[WesternCTF2018]shrine writeup](/img/26/1700095c9b38b9b74a1b1136e5d5de.jpg)
[WesternCTF2018]shrine writeup
![[Maya] the error of importing Maya into Metahuman](/img/46/46bd1c2d507c9e48ef8c066c54231d.jpg)
[Maya] the error of importing Maya into Metahuman

机器学习基本概念

Unity AssetBundle subcontracting
![[IVX junior engineer training course 10 papers] 06 database and services](/img/68/967566fc2f1d0b93ecd78bdb208b64.jpg)
[IVX junior engineer training course 10 papers] 06 database and services

人工智能在网络安全中的作用
随机推荐
Should enterprises choose server free computing?
It's already 30. Can you learn programming from scratch?
[dynamic planning] interval dp:p3205 Chorus
成功实现边缘编码需要了解的六大经验教训
Introduction to ffmpeg Lib
城市选择器组件实现原理
error: . repo/manifests/: contains uncommitted changes
并发编程的三大核心问题
技术大佬准备就绪,话题C位由你决定
No converter found for return value of type: class
基于SSM实现微博系统
Self drawing of menu items and CListBox items
Learning note 3 -- Key Technologies of high-precision map (Part 1)
首场“移动云杯”空宣会,期待与开发者一起共创算网新世界!
Penser au jeu 15: penser au service complet et au sous - service
Matlab uses audiorecorder and recordblocking to record sound, play to play sound, and audiobook to save sound
Android: how can golden nine and silver ten squeeze into the first-line big factories from small and medium-sized enterprises? The depth of interview questions in large factories
ES6 new method of string
Design and control of multi rotor aircraft (VII) -- sensor calibration and measurement model
迁移云计算工作负载的四个基本策略