@@ -81,20 +81,20 @@ let's see an example:
8181 // program to find whether a number is divible by both 3 and 5
8282 // or divisible by only one of them
8383import java.util.Scanner ;
84- public class Main
85- {
86- public static void main ( String [] args ) {
87- Scanner sc= new Scanner (System . in);
88- System . out. println(" Enter a number: " );
89- int a= sc. nextInt();
90-
91- if (a % 3 == 0 && a% 5 == 0 )
92- System . out. println(" The number is divisible by both 3 and 5" );
93- else if (a % 3 == 0 || a% 5 == 0 )
94- System . out. println(" The numbers is divisible by only one of them" );
95- else
96- System . out. println(" The numbers is not divisible by any of them" );
97- }
84+ public class Main {
85+ public static void main ( String [] args )
86+ {
87+ Scanner sc = new Scanner (System . in);
88+ System . out. println(" Enter a number: " );
89+ int a = sc. nextInt();
90+
91+ if (a % 3 == 0 && a % 5 == 0 )
92+ System . out. println(" The number is divisible by both 3 and 5" );
93+ else if (a % 3 == 0 || a % 5 == 0 )
94+ System . out. println(" The numbers is divisible by only one of them" );
95+ else
96+ System . out. println(" The numbers is not divisible by any of them" );
97+ }
9898}
9999```
100100
@@ -189,14 +189,11 @@ This category contains the following operators:
189189 // syntax
190190 // variable = Expression1 ? Expression2 : Expression3;
191191
192- public class Main
193- {
194- public static void main (String [] args ) {
195- int num= 15 ;
196- String msg = num > 10
197- ? " Number is greater than 10"
198- : " Number is less than or equal to 10" ;
199- System .out .println (msg);
192+ public class Main {
193+ public static void main (String [] args ) {
194+ int num = 15 ;
195+ String msg = num > 10 ? " Number is greater than 10" : " Number is less than or equal to 10" ;
196+ System .out .println (msg);
200197 }
201198}
202199
0 commit comments