当前位置:网站首页>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
边栏推荐
- [IVX junior engineer training course 10 papers] 04 canvas and a group photo of IVX and me
- [rust web rokcet Series 1] Hello, world and get, post, put, delete
- Self drawing of menu items and CListBox items
- Learning note 3 -- Key Technologies of high-precision map (Part 1)
- 2022年6月国产数据库大事记
- 电子协会 C语言 1级 33 、奇偶数判断
- Infiltration records of CFS shooting range in the fourth phase of the western regions' Dadu Mansion
- Shell Function
- We should make clear the branch prediction
- Unity AssetBundle subcontracting
猜你喜欢
This is the report that leaders like! Learn dynamic visual charts, promotion and salary increase are indispensable
电商系统中常见的9大坑,你踩过没?
ACM教程 - 快速排序(常规 + 尾递归 + 随机基准数)
ACM tutorial - quick sort (regular + tail recursion + random benchmark)
The technology boss is ready, and the topic of position C is up to you
Edge computing accelerates live video scenes: clearer, smoother, and more real-time
遊戲思考15:全區全服和分區分服的思考
[IVX junior engineer training course 10 papers to get certificates] 09 chat room production
Edge extraction edges based on Halcon learning_ image. Hdev routine
[disease detection] realize lung cancer detection system based on BP neural network, including GUI interface
随机推荐
How does schedulerx help users solve the problem of distributed task scheduling?
[WesternCTF2018]shrine writeup
KS006基于SSM实现学生成绩管理系统
Pyldavis installation and use | attributeerror: module 'pyldavis' has no attribute' gensim '| visual results are exported as separate web pages
Quatre stratégies de base pour migrer la charge de travail de l'informatique en nuage
Unity AssetBundle subcontracting
Docker安装Oracle_11g
I Brief introduction of radio energy transmission technology
Learning note 3 -- Key Technologies of high-precision map (Part 1)
Another programmer "deleted the library and ran away", deleted the code of the retail platform, and was sentenced to 10 months
MATLAB realizes voice signal resampling and normalization, and plays the comparison effect
Exclusive delivery of secret script move disassembly (the first time)
Four basic strategies for migrating cloud computing workloads
GL Studio 5 安装与体验
matlab 使用 resample 完成重采样
Docker installing Oracle_ 11g
Load and domcontentloaded in JS
Principle of finding combinatorial number and template code
I'll teach you to visit Amazon RDS for a year and build a MySQL cloud database (only 10 minutes, really fragrant)
[rust web rokcet Series 1] Hello, world and get, post, put, delete