In FUN Mall, Mirchi FM has arranged for a thriller game. Mr.Stev who is the organizer for this event, calls one of the participant and ask him to pick a number. If the participant picks positive number he has to enter into angel house or if he picks zero or negative number he has to enter into ghost house. Write a program to display to which house the participant has to be entered. Given the following algorithm ,order the same in the correct sequence.
Answers
Answer:
Start
Get a number from the user
Check if the number is greater than 0
If greater then
Print("Enter the angel house")
Else if lesser then
Print("Enter the ghost house")
End
Explanation:
He will take put from the user and then will check if it's greater or lesser, then according to the given situation if it's less than 0 then he will enter the ghost house and if it is greater than o then he will enter the angel house
Program in C++
#include<iostream>
using namespace std;
int main()
{
int n;
cout<<"Enter the number which is picked by the participant : ";
cin>>n;
if(n > 0 )
{
cout<<"The participant has to enter into angel house";
}
else
{
cout<<"The participant has to enter into ghost house";
}
return 0;
}
Algorithm:
Step 1: Start
Step 2: Declare a variable n
Step 3: Take the input from the user
Step 4: Check whether the number is positive, negative or zero
Step 5: If the number is greater than zero, display that the participant has to enter into angel house.
And if the number is zero or negative, display that the participant has to enter into ghost house.
Step 6: End