EJERICICIO 5
Realizar un programa que capture 30 números RANDOM y que mande a imprimir los números mayores a 20.
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
using namespace std;
int aleatorio,h;
int main()
{
srand(time(NULL));
cout<<" IMPRESION DE RANDOM " <<endl;
for(h=1; h<=30; h++)
{
aleatorio=rand()/1000;
if (aleatorio>=20){
cout<< aleatorio <<endl;
}
}
return 0;
}
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
using namespace std;
int aleatorio,h;
int main()
{
srand(time(NULL));
cout<<" IMPRESION DE RANDOM " <<endl;
for(h=1; h<=30; h++)
{
aleatorio=rand()/1000;
if (aleatorio>=20){
cout<< aleatorio <<endl;
}
}
return 0;
}
No hay comentarios:
Publicar un comentario