# Python program to check if a string is # palindrome or not # function to check palindrome string def isPalindrome(string): rev_string = string[::-1] return string == rev_string # Main code x = "Google" if isPalindrome(x): print(x,"is a palindrome string") else: print(x,"is...
In this java program, we are going to check whether a given number if palindrome or not? Here, we are taking an integer number and checking whether it is palindrome or not? Submitted by Preeti Jain, on March 11, 2018 Given an integer number and we have to check whether it is ...
# Program to check if a string is palindrome or not my_str = 'aIbohPhoBiA' # make it suitable for caseless comparison my_str = my_str.casefold() # reverse the string rev_str = reversed(my_str) # check if the string is equal to its reverse if list(my_str) == list(rev_str):...
15. Palindrome Check Variants Write a C program to check if a singly linked list is a palindrome or not. Sample Solution: C Code: #include<stdio.h>#include<stdlib.h>#include<stdbool.h>// Node structure for the linked liststructNode{intdata;structNode*next;};// Function to create a ne...
If equal, it is an armstrong number. If not, it isn't. Here's the equivalent Java code: Java Program to Check Armstrong Number Example 2: Check Armstrong number for n digits fun main(args: Array) { val number = 1634 var originalNumber: Int var remainder: Int var result = 0 var n...
5. The if statement is used to check if the returned value is True or False and the final result is printed. advertisement Runtime Test Cases Case 1: Enter string:mom String is a palindrome! Case 2: Enter string:hello String isn't a palindrome! Sanfoundry Global Education & Learning Seri...
inti=2;while(i<=num/2){if(num%i==0){isPrime=false;break;}i++;} Top Related Articles: Sunny Number Program in Java Java Program to reverse the Array java program to check palindrome string using recursion System.out.println(“Enter a number for check in main method:”); ...
So, 145 is a Strong Number. Steps to Check if a Number is a Strong Number Extract the digits: Break the number down into its digits. Find the factorial of each digit: Calculate the factorial of each digit. Add the factorials: Add up the factorials of the digits. Compare the sum: If...
Check give number is Even or Odd #include<iostream.h>#include<conio.h>voidmain(){intno;clrscr();cout<<"Enter any num: ";cin>>no;if(no%2==0){cout<<"Even num";}else{cout<<"Odd num";}getch();} Output Enter any num : 5 Odd num ...
NestedIfLeapYear.c ReEdit NestedIfLeaptest: Fix Minor Bugs NestedifGreatestInteger.c Added 7 programs NumberPattern.c Added a Cprogram to print the no. pattern Number_guessing_game Create Number_guessing_game Number_to_Character.c Add Number_to_Chacarter Program Palindrome.c Added the ...