Page 23 - PowerPoint Presentation
P. 23

The if...else...Statement















                                                                 1     public static void main(String[] args){


                                                                 2      int tea = sc.nextInt();


                                                                 3      if (tea%2==1){

                                                                 4          tea /= 2;


                                                                 5      }


                                                                 6      else{

                                                                 7         tea*=2;


                                                                 8       }


                                                                 9     }
   18   19   20   21   22   23   24   25   26   27   28