You are on page 1of 3

Machine Problem 2: Prog24

Create a complete C# program that will determine the Greatest Common Divisor (GCD) of two inputted
integers.

PSEUDOCODE

BEGIN

Declare function int gcd (int n1, int n2)

IF n2 == 0

Return n1

ELSE

gcd = n2 (n1 modulo n2)

Return gcd

ENDIF

END function int gcd

BEGIN main method

DO

Prompt user to input integer 1

Save input to variable num1 then convert to int

Prompt user to input integer 2

Save input to variable num2 then convert to int

Factor = function int gcd

PRINT num1, num2, factor

Prompt user to try again

WHILE User input != "N"

ENDDO

END Main Method


FLOWCHART

You might also like