• Register
Welcome to Kodlogs, programming questions and answer website.
0 votes
23 views

Problem:

I have got following assignment to complete could anyone help please,  write an expression that will print "even" if the value of user_num is an even number.

by (550 points)  
reshown by

1 Answer

0 votes

Solution:

Code in Python:

input_val = 13

if input_val%2==0:

    print('This is Even No')

else:

    print('This is Odd No')

Java

public class DetectOdd {

public static void main (String [] args) {

int input_val = 0;

input_val = 6;

if (input_val % 2 == 0) {

System.out.println("This is Even No");

}

else {

System.out.println("This is Odd No");

}

return;

}

}

C++

#include <iostream>

using namespace std;

    int main() {

        int input_val = 0;

        input_val = 4;

        if (input_val % 2 == 0) {

            cout << "This is Even No" << endl;

        }

        else {

            cout << "This is Odd No" << endl;

        }

        return 0;

    }

by (5.3k points)  
...