Welcome

Control flow statements

Automated grading of homework assignments and tests

  • fork this repository
  • solve the task
  • commit with proper message
  • commit with proper message

Problems

if01

Given three integers a, b, c, check the following statement “The number b is between a and c”.

Example 1:

Input: a=1
Output: 2

Example 2:

Input: a=-5
Output: -5

Constraints:

  • -1018<=num<=1018

if02

If the number is positive, increase it to 1, else decrease it to 2.

Example 1:

Input: a=5
Output: 6

Example 2:

Input: a=-1
Output: -3

Constraints:

  • -1018<=num<=1018

if03

If the number is positive, increase it to 1, else decrease it to 2. If it is 0, assign 10.

Example 1:

Input: a=-9
Output: -11

Example 2:

Input: a=3
Output: 4

Constraints:

  • -1018<=num<=1018

if04

Find how many positive numbers there are in the given numbers.

Example 1:

Input: a=-2 b=4 c=1
Output: 2

Example 2:

Input: a=3 b=-3 c=-6
Output: 1

Constraints:

  • -1018<=num<=1018

if05

Find how many negative numbers there are in the given numbers.

Example 1:

Input: a=-2 b=4 c=1
Output: 1

Example 2:

Input: a=3 b=-3 c=-6
Output: 2

Constraints:

  • -1018<=num<=1018

if06

Find how many positive and how many negative numbers there are in the given numbers.

Example 1:

Input: a=-2 b=4 c=1
Output: "there are a lot of positive numbers"

Example 2:

Input: a=3 b=-3 c=-6
Output: "there are a lot of negative numbers"

Constraints:

  • -1018<=num<=1018

if07

Given an integer a, check the following conditions: “positive odd number”, “positive even number”, “negative odd number”, “negative even number”, “the number is zero”

Example 1:

Input: a=57
Output: "positive odd number"

Example 2:

Input: a=-24
Output: "negative even number"

Constraints:

  • -109<=num<=109

if08

Given an integer a, check the following conditions: “two-digit odd number”, “two-digit even number”, “three-digit odd number”, “three-digit even number”

Example 1:

Input: a=57
Output: "two-digit odd number"

Example 2:

Input: a=-242
Output: "three-digit even number"

Constraints:

  • -103 < num < 10 3

if09

The two-digit integer is given.
Replace the digits of the number.
True if the resulting number is less than or equal to the old number, otherwise return False.

Example 1:

Input: a=57
Output: False

Example 2:

Input: a=21
Output: True

Constraints:

  • -103 < num < 10 3

if10

Display the message according to the following temperature conditions given to you in Celsius:
Temp<0: "Freezing"
Temp 1-10: "Very Cold"
Temp 11-20: "Cold"
Temp 21-30: "Normal"
Temp 31-40: "Hot"
Temp >40: "Very Hot"

Example 1:

Input: a=21
Output: "Normal"

Example 2:

Input: a=-4
Output: "Freezing

Constraints:

  • -103 < num < 10 3

Warning

  • don’t copy other solutions or any solution
  • don’t remove comments

GitHub

View Github