Cheak three digit number is ‘Palindrom’ or ‘not’..
Let’s understand some concepts..
According to mathematics ”exapands and standards form” three digit number is joined as like that. So, first separate or exapands the number by using ‘division‘ method and then join them by addition and subtraction.
- b=a/100; if number is ‘121’ then after dividing 100 answer is 1 and 1 stores in b.
- c=a%100; after dividing by 100 remainder is 21 and 21 stores in C.
- d=c/10; when c or 21 again diving by 10 then 2 is answer and 2 stores in d.
- e=c%10; after dividing by 10 remainder is 1 then 1 stores in e.
- f=e*100+d*10+b;
- Assume and start from e and solve like standards form.
Some important symbols used in code.
- () small bracket
- && use for ‘and’ use for address
- {} curly bracket
- “” double code

- #include<stdio.h>
- #include<conio.h>
- void main()
- {
- int a, b, c, d, e, f;
- clrscr();
- printf(“Enter any three digit number to cheak number is palindrome or not”);
- scanf(“%d”, &a);
- b=a/100;
- c=a%100;
- d=c/10;
- e=c%10;
- f=e*100+d*10+b;
- If(a==f)
- {
- printf(“It is a Palindrom =%d”, f);
- }
- else
- printf(“It is not a palindrom”);
- getch();
- }

Inputs..
If a =121 then
Results..


