Advertisement
Alhiris

Untitled

Feb 7th, 2019
216
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.25 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstdlib>
  3. #include <time.h>
  4. using namespace std;
  5.  
  6. int n;
  7.  
  8. int main()
  9. {
  10.     srand(time(NULL));
  11.     int random;
  12.     cin>>n;
  13.     random = rand()%(n+1); //random between [0,n] , ((rand()%n)+1) between [1,n]
  14.     cout<<random;
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement