java - Is it possible to find which expression evaluated true in the following if condition and on that basis I can find the value of a -
is possible find expression evaluated true in following if condition , on basis can find value of a.
import java.util.*; class { public static void main(string args[]){ scanner sc=new scanner(system.in); int a=sc.nextint(); for(int i=0;i<100;i++){ if((i==a)||((i+100)==a)||((i+200)==a)||((i+300)==a)||((i+400)==a)||((i+500)==a)||((i+600)==a)||((i+700)==a)||((i+800)==a)||((i+900)==a)){ //code system.out.println("? condition evaluated true"); } } } } //i don't want take more 1 if statement.
in particular case expression (a-i)/100 give index of condition true.
Comments
Post a Comment