Advertisement
TwiNNeR

Paren ekvivalent

Nov 7th, 2014
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.87 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main()
  5. {
  6.     int prv,vtor;
  7.     scanf("%d%d",&prv,&vtor);
  8.     if(prv<=0||vtor<=0) printf("Invalid input");
  9.     else
  10.     {
  11.         int pomoshno;
  12.         if(prv>vtor)
  13.         {
  14.             pomoshno=prv;
  15.             prv=vtor;
  16.             vtor=pomoshno;
  17.         }
  18.         if(vtor>prv)
  19.         {
  20.             pomoshno=vtor;
  21.             vtor=prv;
  22.             prv=pomoshno;
  23.         }
  24.  
  25.         int p=prv,z=1,celbroj=0;
  26.         while(p)
  27.         {
  28.             if(!(z%2))
  29.             {
  30.                 celbroj=celbroj*10+(p%10);
  31.             }
  32.             p=p/10;
  33.             z++;
  34.         }
  35.         p=celbroj;
  36.         int pomomo=0;
  37.         while(p)
  38.         {
  39.             pomomo=pomomo*10+(p%10);
  40.             p=p/10;
  41.         }
  42.  
  43.        
  44.         if(vtor==pomomo) printf("PAREN");
  45.         else printf("NE");
  46.     }
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement