A sequence is an arithmetic sequence if every two successive number has same difference. Suppose thi…

Click here to read the complete problem statement.

If you need help solving this problem, mention your approach and ask specific questions. Please avoid sharing your code and asking the Community to figure out “what’s wrong”.

My code gives correct output but when i submitted it shows wrong answer. Where is the problem?

n = int(input())
for i in range(n):
x, y, z, n = map(int, input().split())
if z - y == y - x:
cal = z - y
number = cal * n
print(“Case %d: %d” % (i+1, number))
else:
print(“Case %d: Error” % (i+1))

#include <iostream>
using namespace std;
int main() {
int n , a , b , c , d;
cin >> n ;
for(int i = 1 ; i <= n ; i++){
cin >> a >> b >> c >> d ;
int x , y ;
x = b-a;
y = c-b;
cout <<"Case"<<" "<<i<<':'<<" ";
if(x==y)
cout << x*d<<endl;
else
cout << "Error"<<endl;
}
}

what’s wrong in this code;
every time my answer is being accepted in the first test case … But on the 2nd test case , it is showing wrong answer,