jueves, 14 de noviembre de 2019

Ejercicio 5 (Parte 2)

Ejercicio 5 (Parte 2)

  • Realizar un programa que capture 30 números RANDOM y que mande a imprimir los números mayores a 20.

#include "iostream"
#include "stdlib.h"
#include "time.h"
#include "iostream"

using namespace std;

int main()
{

  int randi,j;
  srand(time(NULL));

  cout << "IMPRESION DE NUMEROS RANDOM MAYORES A 20" << endl;

  for (j=1;j<=30;j++)
  {
      randi=rand()/1000;

      if (randi>=20)
      {
          cout << randi << endl;
      }

  }

No hay comentarios.:

Publicar un comentario