当前位置:网站首页>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
边栏推荐
- 电商系统中常见的9大坑,你踩过没?
- Ubuntu20.04 PostgreSQL 14 installation configuration record
- Shell Function
- [IVX junior engineer training course 10 papers] 06 database and services
- Brief introduction to the development of mobile network
- Error creating bean with name ‘stringRedisTemplate‘ defined in class path re
- Convolutional neural network (including code and corresponding diagram)
- Exclusive delivery of secret script move disassembly (the first time)
- SAP ui5 beginner tutorial 20 - explanation of expression binding usage of SAP ui5
- 【疾病检测】基于BP神经网络实现肺癌检测系统含GUI界面
猜你喜欢

matlab 实现语音信号重采样和归一化,并播放比对效果

Introduction to ffmpeg Lib

浅浅了解Servlet

Finally got byte offer, 25-year-old inexperienced experience in software testing, to share with you

How to compress video size while adding watermark with one click?

学习笔记2--高精度地图定义及价值
![Private project practice sharing [Yugong series] February 2022 U3D full stack class 009 unity object creation](/img/eb/b1382428d6578b8561d7fcc1a2a5cd.jpg)
Private project practice sharing [Yugong series] February 2022 U3D full stack class 009 unity object creation

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

Leetcode, 3 repeatless longest subsequence

Penser au jeu 15: penser au service complet et au sous - service
随机推荐
【图像增强】基于Frangi滤波器实现血管图像增强附matlab代码
[IVX junior engineer training course 10 papers] 05 canvas and aircraft war game production
[WesternCTF2018]shrine writeup
Unity AssetBundle subcontracting
[IVX junior engineer training course 10 papers to get certificates] 01 learn about IVX and complete the New Year greeting card
Self drawing of menu items and CListBox items
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
Réseau neuronal convolutif (y compris le Code et l'illustration correspondante)
Architecture evolution from MVC to DDD
Day 13 of hcip (relevant contents of BGP agreement)
电子协会 C语言 1级 32、计算2的幂
遊戲思考15:全區全服和分區分服的思考
What is commercial endowment insurance? Is commercial endowment insurance safe?
The concept and application of Cartland number
I Brief introduction of radio energy transmission technology
ES6 new method of string
Learning note 3 -- Key Technologies of high-precision map (Part 1)
SAP ui5 beginner tutorial XXI - trial version of custom formatter of SAP ui5
How to compress video size while adding watermark with one click?
Hcip day 14 (MPLS protocol)