what code do i have to write in otherwise case: print “-1”
What to do in otherwise case?
Hello @RASHMI2000,
Create a function:
- It prints the other two sides in increasing order if they exist and return true.
- Else it returns false.
In the main function print -1 if returned value is false.
Hope, this would help.
Give a like, if you are satisfied.
what is the condition when triplet does not exist?
You need not check for that condition.
fun(){
logic{
implementation:
if triplets are found print and return true;
}
return false;
}
If the control is executing the statement “return false”, it itself indicates that triplets do not exists.
Hope, this would help.