Skip to content

Commit

Permalink
Create Main.java
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesM134 authored Dec 5, 2022
1 parent fcf03db commit e7a99b5
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions 05-div-by-3/Main.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
class Main {
public static void main(String[] args) {
divby3(212123);//true
}

public static void divby3(int div){
int sum = 0

while (div != 0){
sum += div % 10
div = div /10
}

if(sum % 3 ==0){
system.out.println("this number is divisible by 3 ");
else{
system.out.println("this number is not divisible by 3 ");
}
}
}
}

0 comments on commit e7a99b5

Please sign in to comment.