Advertisement
phuongpupil2

PRF192 ws3.q3

Feb 21st, 2020
418
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <math.h>
  4. #include <conio.h>
  5.  
  6. int reverse(int a){
  7. int c,x,rv;
  8. x=1; rv=0;
  9. while (a>0) {
  10. c=a%10;
  11. rv= rv*10 +c;
  12. a/=10;
  13. }
  14. return (rv);
  15. }
  16.  
  17. int main(){
  18. int m,n;
  19. printf("Enter m, n = "); scanf("%d %d",&m,&n);
  20. printf("Palindrome numbers are:");
  21. for(int i=m;i<=n;i++){
  22. if (i==reverse(i)) {
  23. printf(" %d,",i);
  24. }
  25. }
  26. return(0);
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement