Advertisement
196040

SP Kolokvium 1 Paren ekvivalent

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