-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path4.c
38 lines (36 loc) · 857 Bytes
/
4.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
///A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 99.
///Find the largest palindrome made from the product of two 3-digit numbers.
#include<stdio.h>
#include<conio.h>
#include<math.h>
#include<stdlib.h>
void palindrome(int);
long int t=1,k=0;
void main()
{
long int i,j,sum;
long int cross;
for(i=100;i<=999;i++)
{
for(j=100;j<=999;j++)
{
palindrome(i*j);
}
}
printf("%d",k);
}
void palindrome(int x)
{
int r,num=0;
long int y=x;
while(x!=0) ///steps to find palindrome.............
{
r=x%10;
num=(num*10)+r;
x=x/10;
}
if( y==num)
{ if(y>k)
k=y;
}
}