CODECHEF - CIELAB


Problem Code : CIELAB

Problem      : Ciel and A-B Problem

Platform     : Codechef

Language     : C 

Level        : Easy

Link         : CODECHEF

1:  //submitted  
2:  //https://www.codechef.com/problems/CIELAB  
3:  #include <stdio.h>  
4:  #include<stdlib.h>  
5:  #include <string.h>  
6:  void func()  
7:  {  
8:       int a,b;  
9:       scanf("%d",&a);  
10:       scanf("%d",&b);  
11:       int ans=a-b;  
12:       //for +1  
13:       if((ans+1)%10!=0)  
14:       {  
15:            printf("%d\n",ans+1 );  
16:            return;  
17:       }  
18:       //for -1  
19:       printf("%d\n",ans-1 );  
20:  }  
21:  int main()  
22:  {  
23:       int cases=1;  
24:  //     scanf("%d",&cases);  
25:       while(cases--)  
26:       {  
27:            func();  
28:       }  
29:       return 0;  
30:  }  

Comments

Popular

Traversal In A Binary Tree - Tree -3

Pre Order Traversal In Binary Tree

Tree data structure - 2