Write a program to print Palindrome number c language , java language and python language by technic dude

<img fetchpriority=

Write a program of Palindrome Number in C

#include<stdio.h>  
int main()    
{    
int n,r,sum=0,temp;    
printf("enter the number=");    
scanf("%d",&n);    
temp=n;    
while(n>0)    
{    
r=n%10;    
sum=(sum*10)+r;    
n=n/10;    
}    
if(temp==sum)    
printf("this is palindrome number ");    
else    
printf("this is not palindrome");   
return 0;  
}   


Output:


enter the number=121
this is palindrome  number

enter the number=2621
this is not palindrome  number

Write a program of Palindrome number in JAVA

class Main {
  public static void main(String[] args) {

    String str = "DAD", reverseStr = "";
    
    int strLength = str.length();

    for (int i = (strLength - 1); i >=0; --i) {
      reverseStr = reverseStr + str.charAt(i);
    }

    if (str.toLowerCase().equals(reverseStr.toLowerCase())) {
      System.out.println(str + " is a Palindrome String.");
    }
    else {
      System.out.println(str + " is not a Palindrome String.");
    }
  }
}

Output

DAD is a Palindrome String.

Write a program of Palindrome in PYTHON

n=int(input("Enter number:"))
temp=n
rev=0
while(n>0):
    dig=n%10
    rev=rev*10+dig
    n=n//10
if(temp==rev):
    print("This is a palindrome")
else:
    print("This is not a palindrome")




Output

Case 1
Enter number:141
This is a palindrome
 
Case 2
Enter number:267
This is not a palindrome

READ MORE