0

How write for loop program?

output: 10 9 8 7 6 5 4 3 2 1

9th Dec 2016, 5:26 AM
Seng Thai
Seng Thai - avatar
4 Respuestas
+ 5
You have to use reversed function to reverse range value. Here it is for i in reversed(range(1,11)): print(i)
9th Dec 2016, 6:02 AM
Aditya kumar pandey
Aditya kumar pandey - avatar
+ 1
Thanks everyone
9th Dec 2016, 6:36 AM
Seng Thai
Seng Thai - avatar
0
using for loop in c++, we have int i; for(i=10 ; i>0 ; i--) { cout<<i<<endl; } using while, we have int i=10; while(i>0) { cout<<i<<endl; i--; } using do-while we have int i=10; do { cout<<i<<endl; i--; }while(i>0);
9th Dec 2016, 6:31 AM
Morpheus
Morpheus - avatar
0
oh it's python, hell I wrote that much for C++😥
9th Dec 2016, 6:32 AM
Morpheus
Morpheus - avatar