java - "VARIABLE NAME cannot be resolved to a variable" in nested loops -
our task create table listed powers of number inputted user maximum exponent inputted. requirement use of nested loops , that's problems arose. or ideas appreciated.
`//method powers table public static void powers(){ system.out.print("enter base: "); int base = console.nextint(); system.out.print("enter maximum exponent: "); int exponent = console.nextint(); system.out.print("the base " + base); system.out.println(" , maximum exponent " + exponent); system.out.println(); system.out.println("powers of " + base); system.out.println(); system.out.print("x\t"); system.out.println(base + "^x"); for(int = 0;i <= exponent;i++){ for(int = (int)math.pow(base, i);a <= exponent;a++); system.out.print(i + "\t"); system.out.print(a); //error happens here variable "a" } system.out.println(); }`
Comments
Post a Comment