当前位置:网站首页>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
边栏推荐
- Look at the industrial Internet from a new perspective and seek the correct ways and methods of industrial Internet
- Develop those things: how to use go singleton mode to ensure the security of high concurrency of streaming media?
- Another programmer "deleted the library and ran away", deleted the code of the retail platform, and was sentenced to 10 months
- Day 13 of hcip (relevant contents of BGP agreement)
- KS006基于SSM实现学生成绩管理系统
- 10 minutes to get started quickly composition API (setup syntax sugar writing method)
- Edge computing accelerates live video scenes: clearer, smoother, and more real-time
- Basic usage of shell script
- Altium designer measure distance (ctrl+m)
- Design and implementation of radio energy transmission system
猜你喜欢

Have you stepped on the nine common pits in the e-commerce system?

现货黄金分析的技巧有什么呢?
![[IVX junior engineer training course 10 papers] 04 canvas and a group photo of IVX and me](/img/b8/31a498c89cf96567640677e859df4e.jpg)
[IVX junior engineer training course 10 papers] 04 canvas and a group photo of IVX and me

【图像增强】基于Frangi滤波器实现血管图像增强附matlab代码

Infiltration records of CFS shooting range in the fourth phase of the western regions' Dadu Mansion

MPLS experiment operation

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

卷积神经网络(包含代码与相应图解)

Exclusive delivery of secret script move disassembly (the first time)

遷移雲計算工作負載的四個基本策略
随机推荐
Edge extraction edges based on Halcon learning_ image. Hdev routine
MPLS experiment operation
How can I batch produce the same title for the video?
Raspberry pie 4B learning notes - IO communication (1-wire)
Matlab uses audiorecorder and recordblocking to record sound, play to play sound, and audiobook to save sound
Basic number theory -- Gauss elimination
k线图形态这样记(口诀篇)
Error creating bean with name ‘stringRedisTemplate‘ defined in class path re
CEPH buffer yyds dry inventory
Learn C language from scratch day 025 (maze)
卷积神经网络(包含代码与相应图解)
Feature extraction and detection 16 brisk feature detection and matching
Basic usage of shell script
Liteos learning - first knowledge of development environment
遷移雲計算工作負載的四個基本策略
[rust web rokcet Series 1] Hello, world and get, post, put, delete
Ubuntu20.04 PostgreSQL 14 installation configuration record
How to compress video size while adding watermark with one click?
matlab 使用 resample 完成重采样
How does schedulerx help users solve the problem of distributed task scheduling?