Advertisement
rahat62

Toph-An Arithmetic Problem

Jan 30th, 2019
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.32 KB | None | 0 0
  1. #include<stdio.h>
  2.  
  3. int main()
  4. {
  5.     int t,i,a,b,c,d;
  6.     scanf("%d",&t);
  7.  
  8.     for(i=1;i<=t;i++)
  9.     {
  10.         scanf("%d%d%d%d",&a,&b,&c,&d);
  11.         if(b-a==c-b)
  12.         {
  13.             printf("Case %d: %d\n",i,a+(c-b)*(d-1));
  14.         }
  15.         else
  16.             printf("Case %d: Error\n",i);
  17.  
  18.     }
  19.     return 0;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement