Page 21 - PowerPoint Presentation
P. 21
Block Statements
• Can you determine the differences between these
codes?
1 public static void main(String[] args){ 1 public static void main(String[] args){
2 int tea = sc.nextInt(); 2 int tea = sc.nextInt();
3 if (tea<0||tea>100) 3 if (tea<0||tea>100){
4 tea = 100 + tea; 4 tea = 100 + tea;
5 tea = tea % 100; 5 tea = tea % 100;
6 } 6 }
7 }