Quiz 6

--Originally published at My awesome Blog!

What do you think the code below does? answere in the comments

#include <iostream>
#include <stdio.h>
using std::cout;
using std::cin;
using std::endl;

int mcd(int a, int b)
{
int c, d, e;
e = a % b;
do
{
d = b;
b = e;
e = d % b;
} while(e != 0);
return (b);
}

int main(){
int a, b, c, d, e;
cout << “Algoritmo de Euclides ” << endl;
cout << “Introduce un numero ” << endl;
cin >> a;
cout << “Introduce otro numero ” << endl;
cin >> b;
cout << “El M.C.D de los numeros es ” << mcd(a, b) << endl;
return 0;
}


Quiz6

--Originally published at Programing 101

the difficult part: well this quiz was a big one because we need to program not 1 ,not 2 but 4 programs and all of them were different for each other it was like a exam.

so in the first of them : 1

I find difficult the part that i didn’t know what type of program i was making so when i taste it i find out what was all about it, it was a demonstration about how the number changes using different declarations.

the easy part:  all the programing was in the instruction so i dint have to find them all

the difficult part on the second of them :

2

it was easy but the only thing that i had problem was the results because it didn’t match with other answers that my schoolmates get so i check and find out that my problems was that i didn’t declare a or b

the difficult part on the fourth: i get annoyed in this one because i used a lot of if to get the results right

4

i get a lot of bad answers right because i didn’t declare some variables and i didn’t put the } in the end of some ifs and all caught me in the terminal but at the end i manage to solve it

the easy part:

the most easy program that i did was the third one because basically it was a copy paste program

3

what i learned: i didn’t learn anything but i reinforce my knowledge about all the course