martes, 1 de octubre de 2019

CÓDIGO 11


*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 num[20],res[20],h,j,r,vec[20];

int main()
{

    int randi[20],j;
    srand(time(NULL));
    cout<< " ***IMPRECION RANDOM*** " <<endl;
    for(j=0; j<=19; j++)
     {
         randi[j]=rand();

         cout<<randi[j]<<endl;

     }

     cout<< " **NUMEROS MULTIPLICADOS**" <<endl;

     for(h=0; h<=19; h++)
     {
         vec[j]=randi[h]*5;

         cout<<vec[j]<<endl;

     }

    return 0;
}

No hay comentarios:

Publicar un comentario

Examen 4

#include <iostream> #include <stdio.h> #include <stdlib.h> using namespace std; void menu(); void captura(); void i...