Palindrome Number Checker in C

Introduction

The C programming language is a procedural programming language. Between 1969 and 1973, Dennis Ritchie worked on the project. It was created primarily as a system programming language for developing operating systems. Low-level memory access, a small collection of keywords, and a clean style are all qualities that make C language excellent for system programming, such as operating system or compiler development.

Why Learn C Programming Language?

Because it mixes the characteristics of high-level languages with the functionalism of assembly language, C is often referred to as a middle-level computer language. The manipulation of bits, bytes, and addresses in C gives the programmer more control over how the program will behave and more direct access to the underlying hardware mechanisms.

Working programmers influenced, influenced, and field-tested C. As a result, C provides the programmer with exactly what he or she want. C++ is a more advanced version of the C programming language. C++ incorporates all of the features of C, as well as support for object-oriented programming (OOP). Furthermore, C++ includes numerous enhancements and features that make it a “better C,” regardless of whether or not it is used for object-oriented programming.

Palindrome Numbers

A palindrome number is one that looks the same when read backward. It’s a number that’s the same on both sides.

If a number is a palindrome, we reverse it and compare it to the original number; if both numbers are the same after reversal, the number is a palindrome.

Here example 123 isn’t a palindrome number. Whereas, 1221 is a palindrome number.

// C program to checker weather the user input number is a palindrome number
#include <stdio.h>
#include <stdlib.h> 
#include <conio.h>  
  
int main()    
{    
	int num,rem,sum=0,temp;    
	printf("Enter your number : ");    
	scanf("%d",&num);    
	temp=num;    
	while(num>0)    
	{    
	rem=num%10;    
	sum=(sum*10)+rem;    
	num=num/10;    
	}    

	if(temp==sum)    
	{
	printf("Given Number is Palindrome. "); 
	}   
	else
	{    
	printf("Sorry the given number is not Palindrome !!");   
	}
	return 0;  
}  

Output

  • The output if a number is palindrome number is:
  • The output if a number isn’t palindrome number is:
SHARE Palindrome Number Checker in C

You may also like...

Leave a Reply

Your email address will not be published.

Share