Respuesta :

Answer:

I am going to write the if-else statement using C++, python and JAVA

Explanation:

// C++ code:

int main() //enters body of program

{ int points;  //declare variable named points

   cout<<"enter a number"; //inputs a number from user

   cin>>points; //stores the input number in points variable

   if(points<9 || points>51)

//if condition checks if the number in points variable is in range of 9 to 51

   cout<<"invalid";

//if the number is less than 9 OR greater than 51 then it will display invalid

   else

   cout<<"valid";    }

// else number is in range of 9 to 51 and the output displayed is valid.

// JAVA code

import java.util.Scanner; //scanner is used to take the user input

public class Main{

public static void main(String[] args) {

   int points;

   Scanner sc = new Scanner(System.in);

       System.out.println("Enter a Number: "); //takes number from user

       points = sc.nextInt(); //number stored in the points variable

        sc.close();

if(points<9 | | points>51) //if condition to check the range

{System.out.println("invalid");}

//prints invalid when its out of range of 9 to 51

else

{System.out.println("valid");}}}

// prints valid if number in pointer variable is in the given range

#Python code

#takes input from user

userinput=input("enter a number")

#stores input number in points variable

points = int(userinput)

#checks if the range of input number is less than 9 or greater than 51

if points<9 or points>51:

#prints invalid if the number in pointers variable is out of range of 9 to 51

   print('invalid')

else:

   print('valid')

# prints valid if then points variable is in the range of 9 to 51

ACCESS MORE