This example will deal with mathematics. Sometimes (when calculating combinations)
you'll need to calculate a factoriel of n - n!.
The formula for this is n!=n*(n-1)*(n-2)*...*2*1.
Let's dive into the problem. From definition of factoriels we have 0!=1 and 1!=1. For the rest of the numbers we must use the given formula. In computer programming this problem is written with recursion. Here also when building an activity diagram recursion will be introduced. You might call the operation computeFact(n). You'll need a counter to keep track of whether or not the operation has reached the nth factoriel, a variable that keep a track of your computations, and two more to store the values of 0! and 1!.
The complete activity diagram is shown on next picture:
If you're dealing with computer programming you will conclude that this activity diagram is very similar with a procedure (function) that computes factoriels.