Where am i making the mistake? Help please
Tina and Rahul have 1toy each. They are entering into an amusement park but it is not allowed to take the toys inside, so they have to keep it in the boxes provided by the park management. They want to keep the toys together in one box. There are N boxes in total, at this moment there are t(i) toys present in (i)th box and the maximum capacity of the box is denoted by c(i). Rahul and Tina want to know in how many boxes can they keep their toys such that both the toys are in the same box. Input- 4 (count boxes) 1 2 2 4 5 6 6 10 Output 2 My code-#include <iostream> using namespace std; int main() { int n; cin>>n; int x,y; for(int i=1; i<=n; i++) { cin>>x>>y; int c,count; count=0; while(i<n) { c= y-x; if(c/2>=1) count++; } cout<<count<<endl; } return 0; }