Skip to content
Home » C Programs » Palindrome Program in C Using For Loop

Palindrome Program in C Using For Loop

Simple palindrome program in c using for loop. In this program, we can execute this program using for loop in c programming language.

Palindrome Definition in C

Madam, I’m Adam is an example of a palindrome, which is a word, phrase, or sentence that reads the same backwards and forwards. 

When spelled backwards, semordnilaps (the word palindromes in reverse) are words that spell other words. 

A palindrome, such as madam or racecar, is a word, number, phrase, or other sequence of characters that reads the same backward as forward.

If Else Statement in C

In C, the if-else statement is used to carry out operations based on a set of conditions. 

If and only if the given condition is true, the operations specified in the if block are executed. 

If a specified condition is true, use if to specify a block of code to be executed. 

If the same condition is false, use else to specify a block of code to run. If the first condition is false, use else if to specify a new condition to test. Using if else statement in this palindrome program in c using for loop we have executed the program.

Palindrome Program in C Using For Loop

#include<stdio.h>
int main()
{
int i,n,r,s=0;
printf("n Enter The Number");
scanf("%d",&n);
for(i=n;i>0;)
{
r=i%10;
s=s*10+r;
i=i/10;
}
if(s==n)
{
printf("n %d is a Palindrome Number",n);
}
else
{
printf("n %d is not a Palindrome Number",n);
}
}

Output:

Enter The Number9999

9999 is a Palindrome Number

C Program to Print Pyramid Star Pattern 

C Program to Print Reverse Pyramid Pattern of Numbers 

Pyramid Number Pattern Program in C 

Half Diamond Star Pattern in C 

C Program to Print Prime Numbers From 1 to 100 Using For Loop 

C Program to Print Alphabets a to z Using For Loop 

C Program to Print Ascii Value of All Characters in a String 

Floyd Triangle in C Using For Loop 

Pascal Triangle in C Using Only For Loop 

C Program to Round-off a Given Floating Point Value 

Binary releases – Code::Blocks

GDB online Debugger | Compiler – Code, Compile, Run, Debug online C, C++

Online Compiler and Editor/IDE for Java, C/C++, PHP, Python, Perl, etc

C (programming language)

Applications of C Programming That Will Make You Fall In Love With C