If statement help!
hi
Got 2 questions.
1.How can i simplify 4 variables all with same condition?
if a,b,c,d <1 System.out.println("Invalid input");?
How to put this in a simple code?I know it can be done individually.
2.if the above condition is false i dont want my code to go further and calculate the input.How and i able to do this.Presently everytime i enter an invalid number ,it still processes the output but also come up with the statement"invalid number".
Thank you
Valiantangel
Junior Poster in Training
62 posts since Jul 2010
Reputation Points: 10
Solved Threads: 0
write the code as below:
if(a < 1 || b < 1 || c < 1 || d || 1)
{
System.out.print("Invalid Input");
break;
}
adil_bashir
Junior Poster in Training
67 posts since Jan 2012
Reputation Points: 3
Solved Threads: 1