This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
int fibonacci (int n){ | |
if (n==0) | |
return 0; | |
else if (n==1 || n== 2) | |
return 1; | |
else{ | |
return fibonacci (n-1) + fibonacci (n-2); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <math.h> | |
using namespace std; | |
main(){ | |
float numeros [10]; | |
float suma =0, prom =0, desv, desv1; | |
cout << "Introduce 10 numeros para saber la suma, el promedio, y desviación estandar: " << endl; | |
for (int i =0; i <10; i++){ | |
cin >> numeros[i]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
main (){ | |
int anno; | |
cout << "Introduce un año de 4 dijitos para saber si es bisiesto: "; | |
cin >> anno; | |
if (anno < 1752) | |
cout << "No hay años bisiestos antes de 1752" << endl; | |
else if (anno%4 == 0 && (anno%100 != 0 || anno%400==0)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
main(){ | |
char a; int b; float c; int d; | |
cout << "Por favor introdusca un caracter: "; | |
cin >> a; | |
cout << "Por favor introdusca numero entero: "; | |
cin >> b; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
main(){ | |
int x1,x2,x3; | |
cout << "\tIntroduce tres numeros para acomodarlos de menor a mayor\n"; | |
cout << "Numero 1: "; cin >> x1; | |
cout << "Numero 2: "; cin >> x2; | |
cout << "Numero 3: "; cin >> x3; | |
cout << endl; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
main(){ | |
cout << " C" << endl; | |
cout << " i I" << endl; | |
cout << " s s" << endl; | |
cout << " b b" << endl; | |
cout << " e e" << endl; | |
cout << " s s" << endl; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <stdio.h> | |
using namespace std; | |
main() | |
{ /* PROGRAM TO PRINT OUT SPACE RESERVED FOR VARIABLES */ | |
char c; | |
short s; | |
int i; | |
unsigned int ui; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
int factorial(int x){ | |
if (x == 0) | |
return 1; | |
else { | |
int recurso = factorial(x-1); | |
int res = x * recurso; | |
return res; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
int suma (int x1, int x2){ | |
int z; | |
return z = x1 + x2; | |
} | |
int resta (int x1, int x2){ | |
int z; | |
return z = x1 - x2; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
int main(){ | |
int limite1, limite2, i, suma = 0; | |
cout << "Introdusca el numero menor de la serie: "; | |
cin >> limite1; | |
i = limite1; | |
cout << "Introdusca el numero mayor de la serie: "; | |
cin >> limite2; |