C - 10到30之间的随机数

use*_*736 2 c random numbers

我有polje[i]=rand()%30+1;1-30之间的随机,但我怎么能这样做它在10到30之间?

Sam*_*tal 5

polje[i]=rand()%21+10;
Run Code Online (Sandbox Code Playgroud)

%21,为您提供0到20之间的数字.添加10,为您提供10到30之间的数字.

棘手的问题...希望有帮助......