当前位置:网站首页>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
边栏推荐
- GL Studio 5 installation and experience
- A problem about function template specialization
- 6-3漏洞利用-SSH环境搭建
- Leetcode, 3 repeatless longest subsequence
- 城市选择器组件实现原理
- 【疾病检测】基于BP神经网络实现肺癌检测系统含GUI界面
- Appium inspector can directly locate the WebView page. Does anyone know the principle
- Luogu p1775 stone merger (weakened version)
- 遊戲思考15:全區全服和分區分服的思考
- Pyldavis installation and use | attributeerror: module 'pyldavis' has no attribute' gensim '| visual results are exported as separate web pages
猜你喜欢

学习笔记2--高精度地图定义及价值

Based on Simulink and FlightGear, the dynamic control of multi rotor UAV in equilibrium is modeled and simulated

Introduction to ffmpeg Lib

What are the skills of spot gold analysis?

matlab 使用 resample 完成重采样

技术大佬准备就绪,话题C位由你决定

matlab 使用 audioread 、 sound 读取和播放 wav 文件

6-3 vulnerability exploitation SSH environment construction

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

ACM教程 - 快速排序(常规 + 尾递归 + 随机基准数)
随机推荐
遊戲思考15:全區全服和分區分服的思考
Matlab uses resample to complete resampling
电商系统中常见的9大坑,你踩过没?
[IVX junior engineer training course 10 papers] 06 database and services
Should enterprises choose server free computing?
Learn about servlets
Single chip microcomputer -- hlk-w801 transplant NES simulator (III)
Tencent cloud techo youth dream campus trip into Wuhan University
Principle of finding combinatorial number and template code
三分钟学会基础k线图知识
Architecture evolution from MVC to DDD
【图像增强】基于Frangi滤波器实现血管图像增强附matlab代码
游戏思考15:全区全服和分区分服的思考
Game thinking 15: thinking about the whole region and sub region Services
Unity AssetBundle subcontracting
[IVX junior engineer training course 10 papers] 05 canvas and aircraft war game production
技术大佬准备就绪,话题C位由你决定
k线图形态这样记(口诀篇)
I Brief introduction of radio energy transmission technology
MATLAB realizes voice signal resampling and normalization, and plays the comparison effect