0

Someone help to rectify the error

import java.util.Scanner; public class Table { public static void main (String args[]) { System.out.println("lets print a table of 7"); { Scanner input = new Scanner(System.in); } { int i; i = input.nextInt(); for(i=1;i<=10;i++) i=i*5; } } }

24th Aug 2019, 3:27 PM
Ankush Raj
Ankush Raj - avatar
2 ответов
+ 1
you seem to be missing a bracket, I suggest you format your code more consistently. Your main methods curly brackets arent event correct, a open curly with a closed one.
24th Aug 2019, 3:38 PM
Andy Wong
Andy Wong - avatar
0
if you define scope { } everything inside brackets as variable exist only inside. So the input is not visible outside, delete brackets around it. what do you imagine as output ? you read value to i but then you assign i=1 and you lost input value
24th Aug 2019, 10:35 PM
zemiak