Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Este código permite gerar números aleatórios entre 1 e 10 */
- // Apple Xcode
- #include <stdio.h>
- #include <stdlib.h>
- #include <time.h>
- int main (int argc, const char * argv[])
- {
- // random numbers
- int the_result = 0;
- // seed the random sequence generated by rand()
- srand((unsigned)time(NULL));
- // 8 random numbers between 1 and 10
- for (int i = 0; i < 8; i++)
- {
- the_result = (rand() % 10) + 1;
- printf("%3d ", the_result);
- }
- printf("\n");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement