Quiz #6

Hello I’m back!

I’m back with my quiz number six and I’m so excited because it was a ver easy one and I’m glad to tell you that you can practice with it and of course is free😀

Lets start!

Instructions:

  1. Write a function to calculate the greatest common denominator of two positive integers using Euclid’s algorithm. The function should receive two integers and return an integer.Obviously you should test your function, so create a main program that asks the user for two values, calculates the gcd and displays that.

First of all we need to know what is the Euclid´s algorithm so if you want more info about it you can check this web.

Here’s my code:

2016-03-30.png

We have to create a function and in it write the process, it isn´t hard you just need to think logically and try to understand why all the stuff is on that order. I posted about in my last posts and like always you can check it everytime you want to.

I read about the topic and one post of my colleagues was a great help (check him blog here).

See you in my next post!

Top image by: https://www.flickr.com/photos/waxesstatic/2335673197

CC BY-SA 4.0 Quiz #6 by sercho93 is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.