Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Java Solution for Summing Odd and Even Placed Digits Problem #463

Open
Prathamesh-1011 opened this issue Oct 16, 2024 · 1 comment
Open

Comments

@Prathamesh-1011
Copy link

Description:
This issue is for adding a Java solution to compute the sum of odd-placed and even-placed digits of a given integer N. The solution will print the sum of the digits placed at odd positions followed by the sum of the digits at even positions.

Problem Description:
Input: A single integer N where 0 < N ≤ 1,000,000,000.
Output: The sum of digits placed at odd positions on the first line and the sum of digits placed at even positions on the second line.

Constraints:
The input integer N should be a positive integer not exceeding 1 billion.
Positions are considered 1-based (i.e., the first digit is at position 1, the second digit is at position 2, and so on).

Output Format

Sample Input
2635
Sample Output
11
5
Explanation
5 is present at 1st position, 3 is present at 2nd position, 6 is present at 3rd position and 2 is present at 4th position.

Sum of odd placed digits on first line. 5 and 6 are placed at odd position. Hence odd place sum is 5+6=11

Sum of even placed digits on second line. 3 and 2 are placed at even position. Hence even place sum is 3+2=5

@Prathamesh-1011
Copy link
Author

@Kavya-24 Please assign me this under the Octoberfest 2024 Label :) and a good first issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant