Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren0
scanning numbers using scanf or anything horizontally
often times in my online problems the problems asks or displayed in this order inputs : 4 4 4 4 4 5 5 3 where there is a space and the next input cursor appears after a space and i cant achieve this... can anyone help me with this i use c language
3 Antworten
+ 2
It's the same for which you try to read line by line except don't read \n explicitly...
scanf("%d %d", &n, &m); reads 2 integer inputs which are space separate.
scanf("%d", &n) ;
scanf("%d", &m); also works fine ..
hope it helps....
0
It often tells you to take n inputs in such way..
exm--
8
1 3 5 7 11 13 17 19
test case are 8 and 8 inputs horizontally
0
Can you show which your code is not working for these kind of horizontal input..?