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

6 次查看(过去 30 天)
Without using sort

采纳的回答

KSSV
KSSV 2022-7-11
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

更多回答(1 个)

Hrusheekesh
Hrusheekesh 2022-7-11
n=11;
while n>1
n=n-1
end

类别

Help CenterFile Exchange 中查找有关 Loops and Conditional Statements 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by