Convert Java program to Python program | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
0

Convert Java program to Python program

Hello I am learning Java programming I know Python programming language very well. Could you please convert the Python program to java program . This the program for sum of digits . n="100" sum_of_digits=0 for i in range(len(n)): sum_of_digits+=int(n[i]) print(sum_of_digits)

24th Aug 2020, 5:33 AM
Varshith
Varshith - avatar
3 Respostas
0
Yes šŠš¢š¢š›šØ š†š”ššš²ššš„ I have tried .
24th Aug 2020, 5:39 AM
Varshith
Varshith - avatar
0
I have tried this in java class sample{ public static void main(String args[]){ String s="123"; int count=0; for(int i=0;i<s.length();i++){ count+=Integer.parseInt(s.charAt(i)); } } }
24th Aug 2020, 5:41 AM
Varshith
Varshith - avatar
0
Thank you šŠš¢š¢š›šØ š†š”ššš²ššš„ but why you have used double quotes at line 7
24th Aug 2020, 6:08 AM
Varshith
Varshith - avatar