Help me in solving C_RATING problem

My issue

why isn’t ceil function working

My code

#include <iostream>
#include<cmath>
using namespace std;
int main() {
    int t;
    cin>>t;
    int arr[2];
    while(t--){
    cin>>arr[0]>>arr[1];
    if(arr[0]==arr[1]){
        cout<<0<<endl;
    } else if (arr[1]>arr[0]){
        int w = arr[1]-arr[0];
        double result = w/8;
        cout<<ceil(result)<<endl;
    }
}}

Problem Link: C_RATING Problem - CodeChef

Method 1:
Since you want decimal point for double and you declared integer for w. You need to change 8 to 8.0

Method 2:
Change int to double for w.