430 日 , 2024 21:39:08
用各种语言写判断奇偶数

Python

while True:
    num = int(input())
    if (num % 2) == 0:
        print('偶数')
    else:
        print('奇数')

C 语言

#include <stdio.h>

int main(){
    while (1){
        int num;
        scanf("%d", &num);
        if ((num % 2) == 0){
            printf("偶数");
        }else{
            printf("奇数");
        }
    }
}

JAVA(ChatGPT翻译)

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (true) {
            int num = scanner.nextInt();
            if (num % 2 == 0) {
                System.out.println("偶数");
            } else {
                System.out.println("奇数");
            }
        }
    }
}

PinkShell

$ mode compile;

defined function auto_int main() do
    while do
        auto_int num -> input();
        if (num % 2) == 0 then
            output.echo('偶数');
        else
            output.echo('奇数');
        end
    end
end
暂无评论

发送评论 编辑评论


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
呼呼