Skip to content

Commit

Permalink
1281
Browse files Browse the repository at this point in the history
  • Loading branch information
isinsuarici committed Jan 26, 2022
1 parent 2ea3c12 commit dccae48
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions E_1281_SubtracttheProductandSumofDigitsofanInteger.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
public class Solution {
public int subtractProductAndSum(int n) {
int toplam=0,carpim=1;
while(n!=0) {
toplam= (n%10)+toplam;
carpim= (n%10)*carpim;
n/=10;
}
return carpim-toplam;
}
}

0 comments on commit dccae48

Please sign in to comment.