jueves, 14 de noviembre de 2019

Programa 11 (Parte 2)

Programa 11 (Parte 2)
  • Generar 20 números RANDOM, guardarlos en un vector y pasarlos a otro vector pero multiplicándolos por 5, cada uno de los números.

#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>

using namespace std;

int r,j,h,aleatorio[20],vec1[20],vec2[20];
int main()
{
    srand(time(NULL));
    cout <<"  IMPRESION DE NUMEROS RANDOM  "<<endl;
    for(j=0; j<=19; j++)
    {
        aleatorio[j]=rand();
        cout <<"\t" << aleatorio[j] <<endl;
        vec1[j]=aleatorio[j];
    }

    for(j=0; j<=19; j++)
    {
        vec2[h]=aleatorio[j];
        {
            h++;
        }
        r=vec1[j]*5;
        cout << endl << vec1[j] <<"x" << 5 <<"=" << r;

    }

    return 0;

}

No hay comentarios.:

Publicar un comentario