Здравствуйте, я хочу напечатать числа от 30 до -30, это мой код
#include <iostream>
#include <ctime>
#include <cstdlib>
using namespace std;
int main(){
srand(time(0));
int arr[20] = {0};
for(int i = 0; i < 20; i++){
arr[i] = rand() % 30+(-30);
}
for(int i = 0; i < 20; i++){
cout << arr[i] << " "<<endl;
}
return 0;
}
Не знаю почему, но все числа отрицательные?