Ledger Nano X - The secure hardware wallet
SHARE
TWEET

Untitled

a guest Mar 29th, 2020 53 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #define _CRT_SECURE_NO_WARNINGS
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4. #define MAX_LENGTH 100
  5.  
  6. int isEmpty(int* stack, int* top)
  7. {
  8.  
  9.     if (top == -1)
  10.         return 1;
  11.     else
  12.         return 0;
  13. }
  14.  
  15. int isFull(int* stack, int* top)
  16. {
  17.     if (top == MAX_LENGTH - 1)
  18.         return 1;
  19.     else
  20.         return 0;
  21.  
  22. }
  23.  
  24. int Push(int val, int* stack, int* top)
  25. {
  26.     if ((*top) == MAX_LENGTH - 1)
  27.         printf("stack overflow \n");
  28.     else
  29.     {
  30.         ++(*top);
  31.         *(stack + *top) = val;
  32.     }
  33.  
  34. }
  35.  
  36.  
  37. int Palindrom(int n)
  38. {
  39.     int aux;
  40.     int invers = 0;
  41.     aux = n;
  42.     while (aux)
  43.     {
  44.         invers = invers * 10 + aux % 10;
  45.         aux = aux / 10;
  46.     }
  47.     if (invers == n)
  48.         return 1;
  49.     else
  50.         return 0;
  51. }
  52.  
  53. int main()
  54. {
  55.     int val, stack, top;
  56.     int n, invers = 0, aux;
  57.    
  58.     printf(" Introduceti numarul n de la tastatura: \n");
  59.     scanf("%d", &n);
  60.    
  61.     if (Palindrom(n))
  62.         push(val, stack, top);
  63.     else
  64.         printf("Nu este palindrom \n");
  65.     system("pause");
  66.     return 0;
  67. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top