In: Computer Science
32. Write a proper decision structure that checks the following conditions and if both conditions are correct ,sets the value of the “Qualification’’ variable equal to True, if any of the conditions does not hold, set the value equal to False.
Bool Qualification;
Condition1: Age Must be Greater than or equal to 21
Condition2: Weight Must be Greater than 190 lbs.
USING C#
C# code:
using System;
class Qualification {
static void Main() {
//initializing Qualification as true
bool Qualification=true;
//accepting age
int age=Convert.ToInt32(Console.ReadLine());
//accepting weight
int weight=Convert.ToInt32(Console.ReadLine());
//checking if age is less than 21 or weight is less than or equal
to 190
if(age<21 || weight<=190)
//setting Qualification as false
Qualification=false;
//printing Qualification
Console.WriteLine(Qualification);
}
}
Screenshot:
Input and Output: