Computer Science, asked by zaidializafir, 4 days ago

write a program that takes a number and checks whether the number is odd or even ​

Answers

Answered by lvveni69
1

mark me as brain list

num = int (input (“Enter any number to test whether it is odd or even: “) if (num % 2) == 0: print (“The number is even”) else: print (“The provided number is odd”) Output: Enter any number to test whether it is odd or even: 887 887 is odd. The program above only accepts integers as input

Answered by purveshKolhe
6

\huge{\red{\overbrace{\underbrace{\mathfrak{\blue{answer::}}}}}}

Java-

import java.util.Scanner;

public class Check {

  public static void main(String [] args) {

     Scanner sc= new Scanner(System.in);

     int input = sc.nextInt();

     if (input % 2 == 0) {

        System.out.println("The given number is even");

     }

    else{

       System.out.println("The given number is odd");

     }

  }

}

Python-

usin = int(input())

if usin % 2 == 0:

  print("The given number is even")

else:

  print("The given number is odd")

C++-

#include <iostream>

using namespace std;

int main() {

  int usin;

  cin >> usin;

  if (usin % 2 == 0) {

     cout << "The given number is even";

  }

  else {

    cout << "The given number is odd";

  }

  return 0;

}

Hope it helps...

Similar questions