How to read input separated comma and space in Java and C programs | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
0

How to read input separated comma and space in Java and C programs

input formate 1,2,3,4 and 1 2 3 4

16th Aug 2018, 2:41 AM
Hema Medicharla
Hema Medicharla - avatar
2 Antworten
0
Hema Medicharla below is the way to achieve both input format: //for c char s[100]; scanf("%[^\n]s",s); //for c++ string s; getline(cin,s); Note that you need to use #include<string> to use string command in c++ I am not aware about Java
16th Aug 2018, 5:33 AM
Ketan Lalcheta
Ketan Lalcheta - avatar
0
Thank you
21st Aug 2018, 4:12 AM
Hema Medicharla
Hema Medicharla - avatar