The input contains a sequence of positive integers not exceeding 1000 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

The input contains a sequence of positive integers not exceeding 1000

The sequense ends with -1. Total amount of numbers is not more than 100. Output total amount of numbers is the sequense (not summing -1) and than numbers themselves. Input: Sequence is not bigger that 100. (Input: 1 3 5 -1 Output: 3 1 3 5) https://code.sololearn.com/cNrprrWXvj1d/?ref=app

30th Sep 2021, 3:56 AM
Le.7
2 Answers
+ 1
Two problems here: 1. Inside your for loop your condition should be just "i < 100" 2. You will need 2 loops if you want to output the size first. Just like that: https://code.sololearn.com/cKHJSmuXPmNX/?ref=app
30th Sep 2021, 4:36 AM
Aleksei Radchenkov
Aleksei Radchenkov - avatar
+ 1
Thank you!
30th Sep 2021, 4:50 AM
Le.7