pseudo code and flow charts

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

  1. 👍
  2. 👎
  3. 👁
  1. ascascasc

    1. 👍
    2. 👎
  2. READ 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

    1. 👍
    2. 👎

Respond to this Question

First Name

Your Response

Similar Questions

  1. Programming logic and design

    Design a program that lets the user enter the total rainfall for each 12 months into an array. The program should calculate and display the total rainfall for the year the average monthly rainfall, and the month with the highest

  2. Computer Literary

    Which of the following is Not an example of debugging A)Looking for errors in programming code B)Fixing misspelled commands in programming code C)Solving faulty logic in programming code D)Upgrading to improve the programming code

  3. Algorithm

    write a pseudo code algorithm that will accept 20 numbers and finds their product

  4. computer science

    Pseudo code: Input a list of employee names and salaries, and determine the mean (average) salary as well as the number of salaries above and below the mean

  1. biology

    What can be said about mitochondria and its genetic code? Select all that apply. Mitochondria are unable to synthesize proteins using their genetic code. Mitochondrial proteins are made up of entirely different amino acids. The

  2. pseudo code algorithm

    Write a pseudo code algorithm which: • Determines the average weight of a person over a particular year. • For each month, your algorithm should input the person's weight for that month (a positive real number). Your algorithm

  3. c programming

    a student designed a program to accept the age of an employee and then compute the employees retirement year and display the same in a statement on the screen required. a) write out the pseudo-code for the program above b) write

  4. Algorithm

    write a pseudo code algorithm that will accept the marks in a test for a group of 25 students then calculate and display the average mark

  1. Programming

    write a pseudo code and then draw a flowchart to calculate tax deduction of employess salary >2000, tax is 7% and salary

  2. Ed Tech

    What does the code of conduct include? A. A secret code for internet users B. The conduct that should be used with a code C. A set of rules for behavior when using the internet D. A rule that tells you the code I think C Thanks!

  3. Programming

    Draw a flowchart or write pseudo code to represent the logic of a program that allows the user to enter values for the current year and the user’s birth year. The program outputs the age of the user this year. Preferably a

  4. computer

    Design a program to input the prices of two items as well as the quantities purchased and compute the amount of the sale. Use both pseudo code and flowchart diagrams.

You can view more similar questions or ask a new question.