Write a program to input three digit number and check number is palindrome or not.
Program in C Language
About Program:- Here we will learn C Language through a basics. Programming in C is a very easy if you understand its logic. Here we input 3 number and check its palindrome or not.
First we use printf for print a messege to user and ask three number and we take input by using scanf and finally after this logic section. First we break its digit like 235 to 2,3,5 and check 1st and 3rd are equal or not.
If 1st and 3rd digit are equal then enter number is palindrome or not. So let's see code.....
#include<stdio.h>
#include<conio.h>
void main()
{
int n,a,b;
clrscr();
printf("Enter a 3 digit number=");
scanf("%d",&n);
a=n/100;
b=n%10;
if(a==b)
printf("\nThis is Palindrome ");
else
printf("\nThis is not Palindrome ");
getch();
}
OUTPUT
Enter a 3 digit number=232
This is Palindrome
OR
Enter a 3 digit number=234
This is not Palindrome
Related Programs
clrscr();
printf("Enter a 3 digit number=");
scanf("%d",&n);
a=n/100;
b=n%10;
if(a==b)
printf("\nThis is Palindrome ");
else
printf("\nThis is not Palindrome ");
getch();
}
OUTPUT
Enter a 3 digit number=232
This is Palindrome
OR
Enter a 3 digit number=234
This is not Palindrome
Related Programs
- Write a program to input two digit number and check number is palindrome or not.
- Write a program to input speed of Royal Enfield and check it's running at economic speed or not.
- Write a program to input length and width of a shape and find shape is square or rectangle.
- Write a program to input sell price and cost price and find transaction is profit or loss.
Share your programmer friends
Comment and subscribe for recently updates....
Comments
Post a Comment