shaadi.com

Searching...
Wednesday, 12 June 2013

Assignment C


/*  Assignment
Program Ex1.c */

void main()
{
int rem1=0,rem2=0;
int i, j, m, n, a, b, c, d;
float x,y,z,p,q,div;

clrscr();

   printf("\n\n Program for cancelation of fraction \n\n");

for(i=10; i<100; i++)
{
for(rem1=0,rem2=0,j=10; j<100; j++)
{
n=i;
x=i;

m=j;
y=j;

rem1=n%10;     //Finding the remainder
b=rem1;         //Finding the unit value of numerator
a=(n-rem1)/10;     //Finding the tenth value of numerator


rem2=m%10;          //Finding the remainder
d=rem2;            //Finding the unit value of denominator
c=(m-rem2)/10;     //Finding the tenth value of denominator

p=b;                //Initializing variable p with b
q=c;                //Initializing variable q with c

if(a==d)
{
z=x/y;
div=p/q;

if(z==div)
{
printf(" The value of the fraction [%d/%d]=%2.2f , [%d/%d]=%2.2f\n",i,j,z,b,c,div);
}
}
}
}
printf("\n\n\n Press any key to exit....");
getch();
}

0 comments:

Post a Comment