Random number
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | #include <stdio.h> #include <stdlib.h> #include <time.h> int main(void) { srand(time(NULL)); unsigned short int stopNumber = 0; unsigned short int count = 0; while (stopNumber != 121) { count++; stopNumber = rand() % 255; printf("%d\n", stopNumber); } printf("\nHow many? %d\n", count); return 0; } | cs |
0 개의 댓글:
댓글 쓰기