EJERCICIOS DE ARREGLOS.
shannon315Tarea2 de Marzo de 2016
331 Palabras (2 Páginas)187 Visitas
EJERCICIOS DE ARREGLOS
CLAUDIE SHANNON VILLAMAR RAMÍREZ
PROFESOR JOSE GILBERTO MOLINA
UNIVERSIDAD NACIONAL DE COLOMBIA
FACULTAD DE INGENIERÍA
PROGRAMACIÓN DE COMPUTADORES
2015
EJERCICIO 14
#include
using namespace std;
int main(){
int X[5];
int b;
int c=4;
int d=0;
for(int i=0;i<4;i++){
cout<<"ingrese un numero:";
cin>>b;
if(b==0){
X[c]=b;
c--; }
else {
X[d]=b;
d++;} }
for(int i=0;i<8;i++) {
cout<<" "<
return 0;}
[pic 1]
EJERCICIO 15
#include
using namespace std;
int pot (int x,int y){
if (y==0)
{return 1; }
return pot (x,y-1)*x;}
int main(){
int a;
cout<<"ingrese la dimension: ";
cin>>a;
int K[a];
int i;
int suma=0;
cout<<"ingrese un numero: ";
cin>>K[i];}
cout<
cout<
for (i=a-1;i>=0;i--) {
cout<
{suma=suma + K[i]*(pot(2,i));}
cout<
return 0;}
[pic 2]
EJERCICIO 13
#include
using namespace std;
main() {
int x,n[5],z=0;
float me;
cout<<"Digitar los numeros del arreglo ";
for(x=0;x<5;x++) {
cout<<"nnumero "<
cin>>n[x];
z=+z+n[x]; }
me=z/5;
cout<<"la mediana es: "<
return 0; }
[pic 3]
...