Advertisement
jordanov

paren ekvivalent

Oct 27th, 2015
507
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main(){
  4.  
  5. int a,b,c1,c2,tmp,paren;
  6.  
  7. scanf("%d %d", &a, &b);
  8. if(a<=0 || b<=0){
  9. printf("Invalid input\n");
  10. }
  11. else{
  12. if(a>b)
  13. tmp=a;
  14. a=b;
  15. b=tmp;
  16.  
  17. paren = 1;
  18. b /= 10;
  19. while(a>0){
  20. c1 = a%10;
  21. c2 = b%10;
  22. if(c1 != c2){
  23. paren = 0;
  24. }
  25. a /=100;
  26. b /=100;
  27. }
  28. if(paren){
  29. printf("PAREN\n");
  30. }
  31. else {
  32. printf("NE\n");
  33. }
  34. }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement