Skip to content

Commit

Permalink
added changes to Q and A
Browse files Browse the repository at this point in the history
  • Loading branch information
sameerbiradar200 committed Sep 26, 2024
1 parent 5fd765f commit 7ed257c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/main/java/interview_Coding_Questions/SumOfDigits.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package interview_Coding_Questions;

import java.util.Arrays;
import java.util.stream.Collectors;

public class SumOfDigits {
public static void main(String[] args) {
int a =1213456;
System.out.println("given int is : "+a);
int r = Arrays.stream(String.valueOf(a).split("")).mapToInt(Integer::parseInt).sum();
System.out.println("sum is : "+r);
}
}
Binary file not shown.
Binary file not shown.

0 comments on commit 7ed257c

Please sign in to comment.