Skip to content

Commit

Permalink
Sum of the numbers break by words
Browse files Browse the repository at this point in the history
  • Loading branch information
Arijit-SE committed Mar 1, 2023
1 parent 5aee9ca commit 8fce694
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions SumOfNum.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,23 @@
package Java;
/* Input : 123Arijit1998Arijit10
* Process :
* -----------
* Array : [123, Arijit, 1998, Arijit, 10]
* Now you should sum up the position of that array where numbers are stored.
* 123 + 1998 = 2121
*
* Output :
* --------------
* 2131
*/

import java.util.*;
public class SumOfNum
{
public static void main(String[] args)
{
int sum=0,num=0;
String str = "123Arijit1998Arijit";
String str = "123Arijit1998Arijit10";
for (int i = 0; i < str.length(); i++) {
if(Character.isDigit(str.charAt(i)))
{
Expand Down

0 comments on commit 8fce694

Please sign in to comment.