Wrong output from for-loop

Hello,

I have the following code

1
2
3
4
5
6
7
8
9
10
11
12
13
vector<int> calculateSeries(int lån, int år) {
    constexpr int rente = 10;
    vector<int> innbet(år);
    int remLoan = lån;
    for (int i = 0; i < år; i++) {
        innbet[i] = ((lån/år) + (rente/100)*remLoan);
        remLoan -= innbet[i];
        
        
    }
    return innbet;
    
}


When I run the code from main, I get a vector of 500s as output, i.e. innbet[i] has a constant value of 500. Why? I tried breakpoints in my code and remLoan changes as intended, but clearly innbet doesn't. Anyone?
Integer division.
Everywhere.
Thank you, figured it out now!!
Topic archived. No new replies allowed.