You have to print the series 5,4,3,2,1,0,1,2,3,4,5 | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
+ 1

You have to print the series 5,4,3,2,1,0,1,2,3,4,5

10th Nov 2017, 4:06 PM
Sangee Singh
Sangee Singh - avatar
2 Réponses
+ 7
for(int i=-5;i<=5;i++) { cout<<abs(i)<<' '; }
10th Nov 2017, 4:23 PM
Kinshuk Vasisht
Kinshuk Vasisht - avatar
+ 1
print(*[str(i)[-1] for i in range(-5,6)],sep=",")
10th Nov 2017, 6:48 PM
sayan chandra
sayan chandra - avatar