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;
}


Quiz 5

--Originally published at My awesome Blog!

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

int find_threes(int number[], int numNumbers){
int sum = 0;
for(int i = 0; i < numNumbers; i++){
if (number[i] % 3 == 0)
{
sum += number[i];
}
else
{

}
}
return sum;
}

int main(){
const int NUM_NUMBERS=8;
int x[NUM_NUMBERS];
for (int i = 0; i < NUM_NUMBERS; i++){
cout << “Dame un número “;
cin >> x[i];
}
int sum = find_threes(x,8);
cout << “La suma es ” << sum << endl;
}

Here is the code from my quiz 5. Type down the comments what do you think i do