how to write a code using while end loop for display of number from 10 to 1 descending order ?

2 views (last 30 days)
Without using sort

Accepted Answer

KSSV
KSSV on 11 Jul 2022
n = 10 ;
while n ~= 1
n = n-1
end
n = 9
n = 8
n = 7
n = 6
n = 5
n = 4
n = 3
n = 2
n = 1

More Answers (1)

Hrusheekesh
Hrusheekesh on 11 Jul 2022
n=11;
while n>1
n=n-1
end

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!