Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
if-condition Challenge | Control Structures
course content

Зміст курсу

C# Basics

if-condition Challengeif-condition Challenge

Write an if-condition which checks if the variable x is in the range of 40 to 70 (including 40 and 70). Use the <= operators for comparison. If the condition is true, it should output "In Range".

cs

main.cs

1. The syntax of an if-condition is:
if(condition) { /* code to execute */ }

using System;

namespace ConsoleApp
{
    class Program
    {
        static void Main(string[] args)
        {
            int x = 55;

            // Write code below this line
            if (40 <= x && x <= 70)
            {
                Console.WriteLine("In Range");
            }
            // Write code above this line

        }
    }
}
      

Все було зрозуміло?

Секція 3. Розділ 6
course content

Зміст курсу

C# Basics

if-condition Challengeif-condition Challenge

Write an if-condition which checks if the variable x is in the range of 40 to 70 (including 40 and 70). Use the <= operators for comparison. If the condition is true, it should output "In Range".

cs

main.cs

1. The syntax of an if-condition is:
if(condition) { /* code to execute */ }

using System;

namespace ConsoleApp
{
    class Program
    {
        static void Main(string[] args)
        {
            int x = 55;

            // Write code below this line
            if (40 <= x && x <= 70)
            {
                Console.WriteLine("In Range");
            }
            // Write code above this line

        }
    }
}
      

Все було зрозуміло?

Секція 3. Розділ 6
some-alt