English, asked by shivika35, 10 months ago

An island called “Wonderland” is filled with treasures. Raj is trying to get the treasure. To get it, he has to reach the end of the snow land in the island but got puzzled in the mid-way by a hint he got there. The hint is stating that to cross the snow land he has to jump on the ice stones which is of pairs else he will be drowned in the cold river. He has to check whether the number of ice stones is in pairs or not. Suggest him a logic to check the pairs of stones and say whether he can get the treasure or not. The input should be an integer. The output should be either Possible or Not possible. using ternery operator in c++ programming

Answers

Answered by nidaeamann
2

Explanation:

The solution is requiring a computer program written in C++ language. It will be based on simple algorithm to determine whether a given number is even or odd and that shall be done by dividing the number by 2 and checking the remainder

Code

Int main void

int input

int remainder

prinf("Enter the number of stones")

scanf (&input)

remainder = input/2;

if remainder == 0

printf("Possible to cross")

else

printf("NOT Possible to cross")

return

Answered by sravani55555
16

Answer:#include<iostream>

int main()

{

int a;

std::cin>>a;

(a%2==0)std::cout<<"Possible":std::out<<"Not Possible";

}

Explanation:

Similar questions