[ create a new paste ] login | about

Link: http://codepad.org/Zusq04Wo    [ raw code | output | fork ]

C, pasted on Sep 3:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/* rand example: guess the number */
#include <stdio.h>
#include <stdlib.h>
#include <time.h>

int main ()
{
  int iSecret, iGuess;

  /* initialize random seed: */
  srand ( time(NULL) );

  /* generate secret number: */
  iSecret = rand() % 10 + 1;

printf("%d",iSecret);

  puts ("Congratulations!");
  return 0;
}


Output:
1
3Congratulations!


Create a new paste based on this one


Comments: