filmov
tv
Sum of digits in the String | Java | Nataraja Murthy #Sum #digits #string #java #youtubeshorts

Показать описание
Task: Given a string str containing alphanumeric characters. The task is to calculate the sum of all the numbers present in the string.
Input:
str = 1abc23
Output: 24
Explanation: 1 and 23 are numbers in the
string which is added to get the sum as
24.
Logic in for loop:
temp = temp*10;
sum+=temp;
#programming #geeksforgeeks #sum #digits #string #youtubeshorts
Input:
str = 1abc23
Output: 24
Explanation: 1 and 23 are numbers in the
string which is added to get the sum as
24.
Logic in for loop:
temp = temp*10;
sum+=temp;
#programming #geeksforgeeks #sum #digits #string #youtubeshorts