Skip to content
Snippets Groups Projects
Commit 39a69b4d authored by Brayan Santiago Amorocho Lizcano's avatar Brayan Santiago Amorocho Lizcano
Browse files

Trabajos en clase

parent 918adc91
No related branches found
No related tags found
No related merge requests found
#include <iostream>
#include <cmath>
using namespace std;
int main() {
int n;
cout << "Ingrese el número de elementos de la serie: ";
cin >> n;
int a = 0, b = 1;
for (int i = 0; i < n; i++) {
cout << a << " ";
int c = a + b;
a = b;
b = c;
}
}
\ No newline at end of file
File added
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
using namespace std;
int main() {
int a, b;
//Ingresamos los terminos
cout << "Ingrese el primer número: ";
cin >> a;
cout << "Ingrese el segundo número: ";
cin >> b;
int mcd = 1;
//Calculamos el mcd
for (int i = 2; i <= min(a, b); i++) {
if (a % i == 0 && b % i == 0) {
mcd = i;
}
}
cout << "El mínimo común divisor de " << a << " y " << b << " es: " << mcd << endl;
}
\ No newline at end of file
File added
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment