Está en la página 1de 2

REPÚBLICA BOLIVARIANA DE VENEZUELA

MINISTERIO DEL PODER POPULAR PARA


LA EDUCACIÓN UNIVERSITARIA
CIENCIA Y TECNOLOGÍA
INSTITUTO UNIVERSITARIO POLITÉCNICO
“SANTIAGO MARIÑO”
EXTENSIÓN MATURÍN

Programación NO Numérica
C++

Autor: Br. Mariana Patiño


Tutor:

Maturín, Noviembre 2020


#include <cstdlib>
#include <stdio.h>

using namespace std;

int main(){
int num, mayor, menor, repeticones;
int MAX_DIMENTION=5;
int tabla [MAX_DIMENTION];

printf("ingrese la cantidad de repeticones: ");


scanf("%d",&repeticones);
if(repeticones<MAX_DIMENTION){
for(int i=0; i<repeticones; i++) {
printf("dime mi numero: ");
scanf("%d",&num);
tabla[i]=num;
if(i==0) {
mayor=num;
menor=num;
}
else{
if (num >mayor) mayor=num;
if (num <menor) menor=num;
}
}
printf("===VALORES DE TABLA===\n");
for(int i=0; i<repeticones; i++) {
printf("Valor en %d = %d \n", (i+1), tabla[i]);
}

printf("el numero mayor era %d \nel numero menor era %d", mayor,
menor);
}else{
printf("Numero de repeticones mayor a dimensiones");
}

return 0;
}

También podría gustarte