1 条题解

  • 0
    @ 2026-2-10 15:52:13

    C :

    #include<stdio.h>
    int main()
    {
    	int n;
    	scanf("%d",&n);
    	if(n%2==0)
    	{
    	printf("even\n");
    	}
    	else
    	{
    	printf("odd\n");
    	}
    }
    

    C++ :

    #include<stdio.h>
    int main()
    {
        int x;
        //freopen("1024A3.in","r",stdin);
        //freopen("1024A3.out","w",stdout);
        scanf("%d",&x);
        if(x%2==1)
        {
            printf("odd\n");
        }
        if(x%2==0)
        {
            printf("even\n");
        }
    }
    

    Java :

    import java.util.Scanner;
    
    public class Main
    {
    	public static void main(String[] args)
    	{
    		Scanner sc=new Scanner(System.in);
    		int a=sc.nextInt();
    		if(a%2!=0) 
    		{
    			System.out.println("odd");
    		}
    		else
    		System.out.println("even");
    
    	}
    }
    
    

    Python :

    # coding=utf-8
    #python2
    a = int(input())
    if a%2==0:
        print("even")
    elif a%2==1:
        print("odd")
    
    

    C# :

    using System;
    using System.Collections.Generic;
    using System.Diagnostics.SymbolStore;
    using System.Linq;
    using System.Security.Cryptography;
    using System.Text;
    using System.Threading.Tasks;
    
    namespace ConsoleApp2
    {
        internal class Program
        {
            static void Main()
            {
                //int[] days = { 31,28,31,30,31,30,31,31,30,31,30,31};
                /*int n = Convert.ToInt32 (Console.ReadLine());
                string[] a1 = Console.ReadLine().Split();
                double r = Convert.ToDouble(a1[0]);
                double b = Convert.ToDouble(a1[1]);
                double c = Convert.ToDouble(a1[2]);
                float pi = 3.1415926f;
                string S = ((r + b+c) / n).ToString("0.00");
                */
                int a=Convert.ToInt16( Console.ReadLine());
                string b = "even";
                if (a%2==1) {
                    b = "odd";
                };
                Console.WriteLine(b);
    
                Console.ReadKey();
    
            }
        }
    }
    
    • 1

    信息

    ID
    18
    时间
    1000ms
    内存
    128MiB
    难度
    1
    标签
    递交数
    0
    已通过
    0
    上传者