Advertisement
aiNayan

4(vii)

Nov 25th, 2020 (edited)
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. /* Buss error
  2. Segment error (core dumped)
  3.  
  4. Problem solved. But some times in runtime it shows the above errors, & sometimes it works fine. Didn't found the actual reason */
  5.  
  6. #include<stdio.h>
  7. #include<math.h>
  8. int main()
  9. {
  10. int n, m=0,digit=log10(n), a[digit], count=0, r;
  11. scanf("%d", &n);
  12. while(n>0)
  13. {
  14. r=n%10;
  15. a[count]=r;
  16. n=n/10;
  17. count++;
  18. }
  19. int i;
  20. for(i=0; i<count; i++){
  21. if(a[i]==a[count-i-1])
  22. m++;
  23. }
  24. if (m==count)
  25. printf("Palindrome");
  26. else
  27. printf("Not palindrome");
  28. return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement