how can write a pseudo code and a flow charts to solve these?

1 to find the greatest common divisor out of two positive integers.
2 to find the smallest common factor out of two positive intrgers.

Write the flow of thinking just as you do it in your head. Work through a sample problem on paper, then model your process as a flow chargt.

Note that you can define the greatest common divisor function recursively:

GCD[x,y] = GCD[y Mod x,x]

And GCD[0,x] = x

ascascasc

READ a,b;

a>=n
C=a%b
If c=0
DISPLAY n is the GCD;
If c is not equal to 0
REPLACE a with b and b with the c and go to c=a%b

Sure! Here's a step-by-step guide on how to write pseudo code and flowcharts to solve the problems of finding the greatest common divisor (GCD) and smallest common factor (SCF) of two positive integers.

1. Finding the Greatest Common Divisor (GCD):
Pseudo code:
Step 1: Take input of two positive integers (let's say 'a' and 'b')
Step 2: If a equals 0, return b
Step 3: If b equals 0, return a
Step 4: Calculate the remainder of 'b' divided by 'a' (let's call it 'rem')
Step 5: Recursively call the GCD function with parameters 'rem' and 'a'
Step 6: Return the result obtained from the recursive call as the GCD

Flowchart:
Start -> Input 'a' and 'b' -> If 'a' equals 0, return 'b' -> If 'b' equals 0, return 'a' -> Calculate 'rem' = b Mod a -> Recursive call GCD with parameters 'rem' and 'a' -> Repeat steps until GCD is found -> Return GCD -> End

2. Finding the Smallest Common Factor (SCF):
Pseudo code:
Step 1: Take input of two positive integers (let's say 'a' and 'b')
Step 2: Initialize a variable 'scf' as the minimum of 'a' and 'b'
Step 3: Start a loop from 'scf' to 1 (decrement by 1 in each iteration)
Step 4: If 'a' modulo 'scf' equals 0 and 'b' modulo 'scf' equals 0, break the loop
Step 5: Continue the loop until a common factor is found
Step 6: Return the value of 'scf' as the smallest common factor

Flowchart:
Start -> Input 'a' and 'b' -> Initialize 'scf' as minimum of 'a' and 'b' -> Start loop from 'scf' to 1 -> If 'a' modulo 'scf' equals 0 and 'b' modulo 'scf' equals 0, break -> Continue loop until common factor is found -> Return 'scf' as smallest common factor -> End

These pseudo code and flowcharts should help you solve the problems of finding the GCD and SCF of two positive integers systematically.

To write pseudo code and flowcharts to solve these problems, let's start with the first one: finding the greatest common divisor (GCD) of two positive integers.

Pseudo code for finding the GCD of two positive integers:

1. Start with two positive integers: num1 and num2.
2. Set x as the smaller number between num1 and num2.
3. Set y as the larger number.
4. If x is zero, return y as the GCD.
5. Compute the remainder of y divided by x and assign it to temp.
6. Set num1 = x and num2 = temp.
7. Repeat steps 2 to 6 until x becomes zero.
8. Return num2 as the GCD.

Now, let's visualize the process in a flowchart:

```
START
|
|--- Input num1, num2
|
|--- x = smaller number between num1 and num2
|
|--- y = larger number between num1 and num2
|
|--- IF x = 0
| |
| |--- RETURN y as the GCD
|
|--- WHILE x > 0
| |
| |--- temp = remainder of y divided by x
| |
| |--- num1 = x
| |
| |--- num2 = temp
| |
| |--- x = smaller number between num1 and num2
| |
| |--- y = larger number between num1 and num2
|
|--- RETURN num2 as the GCD
|
END
```

Moving on to the second problem: finding the smallest common factor of two positive integers.

Pseudo code for finding the smallest common factor:

1. Start with two positive integers: num1 and num2.
2. Set x as the smaller number between num1 and num2.
3. Set y as the larger number.
4. Loop from i = 2 to x:
a. If both x and y are divisible by i, return i as the smallest common factor.
b. If not divisible, increment i by 1.
5. Return x as the smallest common factor if all values from 2 to x are not factors.

Flowchart representation for finding the smallest common factor is as follows:

```
START
|
|--- Input num1, num2
|
|--- x = smaller number between num1 and num2
|
|--- y = larger number between num1 and num2
|
|--- FOR i = 2 to x
| |
| |--- IF x % i = 0 AND y % i = 0
| | |
| | |--- RETURN i as the smallest common factor
| |
|--- RETURN x as the smallest common factor
|
END
```

Remember, pseudo code and flowcharts represent an algorithm in a step-by-step manner. They help translate your thought process into clear and organized instructions.