How can I save and print the biggest random number here?
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
void main()
{
int i,max=0;
srand(time(NULL));
printf("rand gives value between 1-1000\n");
for (i = 0; i < 30; i++)
{
printf("%d ", rand() % 1000 + 1);
}
printf("\nMax is %d", max);
getch();
}
Thank you in advance.
Aucun commentaire:
Enregistrer un commentaire