martes, 5 de noviembre de 2019

Ejercicio 5

*Imprimir 30 numeros random y que solo muestre los mayores a 20



#include <iostream>
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
using namespace std;
int main()
{
    int aleatorio, j;
    srand(time(NULL));
    cout<<"     *Numeros random*"<<endl;
    for (j=1; j<=30; j++)
    {
        aleatorio=rand()/1000;
        if(aleatorio>20)
    cout <<" "<<aleatorio<<endl;

}
}


No hay comentarios:

Publicar un comentario

Cadenas

#include <iostream> #include <stdio.h> #include <string.h> using namespace std; char nombre[50],paterno[50],materno[20...