C#: Check two given numbers where one is less than 100 and other is greater than 200
C# Sharp Basic: Exercise-35 with Solution
Write a C# program to check two given numbers where one is less than 100 and the other is greater than 200.
Sample Solution:-
C# Sharp Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
public class Exercise35 {
static void Main(string[] args) {
// Prompt the user to input the first number less than 100
Console.Write("Input a first number(<100): ");
// Read user input and convert it to an integer 'm'
int m = Convert.ToInt32(Console.ReadLine());
// Prompt the user to input the second number greater than 200
Console.Write("Input a second number(>200): ");
// Read user input and convert it to an integer 'n'
int n = Convert.ToInt32(Console.ReadLine());
// Check if the first number is less than 100 AND the second number is greater than 200
// Print the result of the logical AND operation between the conditions
Console.WriteLine((m < 100 && n > 200));
}
}
Sample Output:
Input a first number(<100): 75 Input a second number(>100): 250 True
Flowchart:
C# Sharp Code Editor:
Previous: Write a C# program to check if a string starts with a specified word.
Next: Write a C# program to check if an integer (from the two given integers) is in the range -10 to 10.
What is the difficulty level of this exercise?
Test your Programming skills with w3resource's quiz.
It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.
https://w3resource.com/csharp-exercises/basic/csharp-basic-exercise-35.php
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics