#include<bits/stdc++.h>
using namespace std;
int check(){
    int p,q;
    int count=0;
    cin>>p>>q;
    if(q-p>=2){
        count++;
    }
    cout<<count;
}
int main(){
    int n;
    cin>>n;
    for(int i=0;i<n;i++){
        check();
    }
}
How to carry forward the value of 'count' in multiple iterations of for loop. Everytime the loop reiterates the 'count' value sets to '0' again but I want it to store values from previous iterations. Since the loop reiterates 'n' but everytime the loop enters, the value of count sets back to 0.
Is there something I can do with the initialization of count (count=0) ??
 
    