0

HELP PLEASE!

How to make a code for printf 2 random int number ??

22nd Oct 2020, 4:18 PM
hafidz ridwan cahya
hafidz ridwan cahya - avatar
4 Antworten
+ 9
Yes I too know that.. infact I had given a thought back of the mind..but I just felt creepy to show all.. Here is my implementation https://code.sololearn.com/c0lS8LRAwwCW/?ref=app Nvm thanks!
22nd Oct 2020, 6:29 PM
Aditya
Aditya - avatar
+ 8
It's simple make use of rand function. https://code.sololearn.com/c1pxrotqmFGh/?ref=app
22nd Oct 2020, 5:35 PM
Aditya
Aditya - avatar
+ 2
EnCoDeR dont forget the srand as well or you might have a fixed seed on the output here try this #include <stdio.h> #include <stdlib.h> #include <time.h> int main() { srand(time(NULL)); for(int i = 0; i<2; i++) printf(" %d ", rand()); return 0; }
22nd Oct 2020, 5:58 PM
Shen Bapiro
Shen Bapiro - avatar
+ 1
Thank you very much
22nd Oct 2020, 6:36 PM
hafidz ridwan cahya
hafidz ridwan cahya - avatar