0

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

30th Aug 2022, 10:08 AM
ANIK
ANIK - avatar
3 Answers
+ 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....
30th Aug 2022, 10:46 AM
Jayakrishna šŸ‡®šŸ‡³
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
30th Aug 2022, 3:58 PM
ANIK
ANIK - avatar
0
Can you show which your code is not working for these kind of horizontal input..?
30th Aug 2022, 4:13 PM
Jayakrishna šŸ‡®šŸ‡³