martes, 1 de octubre de 2019

Ejercicio 21

Ejercicio 21


#include <iostream>
#include <stdio.h>
#include <string.h>
using namespace std;
void captura();
void inverso();
void multiplos();
void sumar();
void restar();
void multiplicar();
int vec1[5],vec2[5],vec3[5],j,h,suma[5],resta[5],multiplicacion[5];
int main()
{
    cout <<"°°CAPTURA DATOS EN UN VECTOR°°" <<endl;
    captura();
    inverso();
    multiplos();
    sumar();
    restar();
    multiplicar();
    return 0;
}
void captura()
{
    for (j=0; j<=4; j++)
    {
        cout <<"\nIngresa el dato:  "<<endl;
        cin >>vec1[j];
    }
}
void inverso()
{
    cout <<"NUMERO INVERSO"<<endl;
    for (j=4; j>=0; j--)
    {
        vec2[h]=vec1[j];
        h++;
        cout <<""<<vec1[j]<<endl;
    }
}
void multiplos()
{
    cout<<"MULTIPLOS DEL 6"<<endl;
    for (j=0; j<=4; j++)
    {
        vec3[j]=(j+1)*6;
        cout <<""<<vec3[j]<<endl;
    }
}
void sumar()
{
    cout <<"SUMA"<<endl;
    for (j=0; j<=4; j++)
    {
        suma[j]=vec1[j]+vec2[j];
        cout<<""<<suma[j]<<endl;
    }
}
void restar()
{
    cout<<"RESTA"<<endl;
    for(j=0; j<=4; j++)
    {
        resta[j]=vec2[j]-vec3[j];
        cout<<resta[j]<<endl;
    }
}
void multiplicar()
{
    cout <<"MULTIPLICAR"<<endl;
    for(j=0; j<=4; j++)
    {
        multiplicacion[j]=vec1[j]*vec2[j];
        cout <<multiplicacion[j]<<endl;
    }
}





No hay comentarios:

Publicar un comentario