0% found this document useful (0 votes)
2 views5 pages

Indu Conditional CodeXpert6

Uploaded by

cs.office.bmasce
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views5 pages

Indu Conditional CodeXpert6

Uploaded by

cs.office.bmasce
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

ASSIGNMENT - 6

Topic: Conditional Statements in Multiple Languages

1) Python Language:

num = 25
print("Number entered:", num)
print("----------------------")
if num > 0:
print("The number is Positive")
elif num < 0:
print("The number is Negative")
else:
print("The number is Zero")
if num % 2 == 0:
print("The number is Even")
else:
print("The number is Odd")
if num > 100:
print("The number is Greater than 100")
else:
print("The number is Less than or Equal to 100")

2) C Language:
#include <stdio.h>
int main() {
int num = 25;
printf("Number entered: %d\n", num);
printf("----------------------\n");

if (num > 0) {
printf("The number is Positive\n");
}

else if (num < 0) {


printf("The number is Negative\n");
}

else {
printf("The number is Zero\n");
}

if (num % 2 == 0) {
printf("The number is Even\n");
}
else {
printf("The number is Odd\n");
}

if (num > 100) {


printf("The number is Greater than 100\n");
}
else {
printf("The number is Less than or Equal to 100\n");
}

return 0;
}

3) C++ Language:

#include <iostream>
using namespace std;
int main() {
int num = 25;
cout << "Number entered: " << num << endl;
cout << "----------------------" << endl;

if (num > 0) {
cout << "The number is Positive" << endl;
}
else if (num < 0) {
cout << "The number is Negative" << endl;
}
else {
cout << "The number is Zero" << endl;
}

if (num % 2 == 0) {
cout << "The number is Even" << endl;
}
else {
cout << "The number is Odd" << endl;
}

if (num > 100) {


cout << "The number is Greater than 100" << endl;
}
else {
cout << "The number is Less than or Equal to 100" << endl;
}

return 0;
}

4) Java Language:

public class Main {


public static void main(String[] args) {

int num = 25;

[Link]("Number entered: " + num);


[Link]("----------------------");

if (num > 0) {
[Link]("The number is Positive");
}
else if (num < 0) {
[Link]("The number is Negative");
}
else {
[Link]("The number is Zero");
}

if (num % 2 == 0) {
[Link]("The number is Even");
}
else {
[Link]("The number is Odd");
}

if (num > 100) {


[Link]("The number is Greater than 100");
}
else {
[Link]("The number is Less than or Equal to 100");
}
}
}

5) JavaScript Language:
let num = 25;
[Link]("Number entered:", num);
[Link]("----------------------");

if (num > 0) {
[Link]("The number is Positive");
} else if (num < 0) {
[Link]("The number is Negative");
} else {
[Link]("The number is Zero");
}

if (num % 2 === 0) {
[Link]("The number is Even");
} else {
[Link]("The number is Odd");
}

if (num > 100) {


[Link]("The number is Greater than 100");
} else {
[Link]("The number is Less than or Equal to 100");
}

Submitted By:
Name: Indu
USN / College: 2AG22CS042 / AITM College, Belagavi
Contact: 9380947735 / indureddyd07@[Link]

You might also like