shaadi.com

Searching...
Wednesday, 12 June 2013

Assignment9




/* Assignment
Program no EX9.c */
void main()
{
int i,j;
int a,b,c,d;
int w,x,y,z;
int m,n;
int temp1,temp2,num=1;
clrscr();

printf("\n The Range of Numbers ");
printf("\n\n (10a+b) * (10c+d) = (10b+a) * (10d+c)");
printf("\n Where a != b && c != d  \n\n");

for(i=10;i<25;i++)
{
if(i%11==0) // To reduce those products which has a=b & c=d
{
continue;
}
temp1=0;
temp2=0;

for(j=10;j<100;j++)
{
if(j%11==0)
{
continue;
}
temp1=i;
temp2=j;

a=temp1/10;
b=temp1%10;

c=temp2/10;
d=temp2%10;


w=i; // Here w=(10a+b)
x=j;     // Here x=(10c+d)
m=w*x; // Here m= (10a+b)*(10c+d)

y=(10*b)+a; // Here y=(10b+a)
z=(10*d)+c; // Here z=(10d+c)
n=y*z;         // Here n=(10b+a)*(10d+c)

if(w!=y && w!=z && x!=y && x!=z)
{
if(m==n)
{
printf("\n %d)  %d * %d = %d * %d ",num,w,x,y,z);
num++;
}
}
}
}
printf("\n\n Press any key to exit....");
getch();
}

0 comments:

Post a Comment