Print numbers in descending order

Hi,

I am trying to print number in descending order say like 9,8,7,6,5,4,3,2,1. For this I’ve taken input from user and trying to decremented that input using do while loop and assign activity as attached:

I’ve defined a variable num and under assign activity I am assigning variable a value as num-1. Is this the correct way to decrement the value.

Attached is the screenshot of the sequence.

image

Thank You

1 Like

@ajeetmish02

Specify condition like num >= 1

1 Like

You should be sending the numbers to an array variable instead. much easier to work with the data then. it can always provide a sorted output.

1 Like

Awesome!!

Thank You @lakshman . I was using incorrect assignment. < instead of >

2 Likes

@ronanpeter

I’ll try this method also.

1 Like

Here is an example workflow to help you in terms of sorting the list.

Sort.xaml (7.1 KB)

Edit: I uploaded a version which converts the strings to Int32 to ensure it is sorted correctly. Using strings “101” would come before “75”. Converting to Int32 resolves this.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.