#include <stdio.h>
#include <string.h>
int main(){
char string1[20];
int i, length;
int flag = 0;
printf("Enter a string:");
scanf("%s", string1);
length = strlen(string1);
for(i=0;i < length ;i++){
if(string1[i] != string1[length-i-1]){
flag = 1;
break;
}
}
if (flag) {
printf("%s is not a palindrome", string1);
}
else {
printf("%s is a palindrome", string1);
}
return 0;
}
#include<stdio.h>
void main(){
int num, cNum, rev, rem;
printf("Enter a number = ");
scanf("%d",&num); //0
cNum = num; //123
rev = 0;
while(cNum != 0){
rem = cNum % 10;
rev = rev * 10 + rem;
cNum /= 10;
}
if(num == rev){
printf("Palindrome");
}
else{
printf("Not Palindrome");
}
}
/*
Palindrome number in c: A palindrome number is a number that is same after
reverse. For example 121, 34543, 343, 131, 48984 are the palindrome numbers.
*/
#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("palindrome number ");
else
printf("not palindrome");
return 0;
}
Code Example |
---|
C :: c/c++ type format |
C :: how to turn off zsh |
C :: c program to add two numbers |
C :: armstrong number in c |
C :: check prime number or not c |
C :: c binary search |
C :: C read a character |
C :: take long long input in c |
C :: c# for loop decrement |
C :: matrix multiplication in c |
C :: C Passing string to a Function |
C :: implicit declaration of function ‘usleep’ [-Wimplicit-function-declaration] |
C :: c convert char to int |
C :: double array in c |
C :: try and catch in rust |
C :: char to int in c |
C :: getting string input in c |
C :: how to compareTo in java |
C :: enregistrement en c |
C :: read file c |
C :: c break statement |
C :: FCFS algorithm in c to find average turnaround time and waiting time |
C :: implement crc using c language |
C :: -42 c to f |
C :: threads in c |
C :: how to make two arrays equal in c |
C :: realloc in c |
C :: linux_reboot_magic2 |
C :: count number of items using delimiter |
C :: convert c code to assembly language |