📅  最后修改于: 2022-03-11 15:04:35.984000             🧑  作者: Mango
/* IT IA A C CODE COVERT A DECIMAL INT0 NORMAL FRACTION AND MIXED FRACTION*/
/* EXAMPLE 1.50 ->3/2 ->1 1/2*/
#include
void main()
{
float f;
int n1,n2,e,g,s,h,i;
printf("enter the float value\n");
scanf("%f",&f);
n1=f*100;
n2=100;
if(n1>n2)
h=n2;
else
h=n1;
for(i=1;i<=h;i++)
{
if((n1%i==0)&&(n2%i==0))
s=i;
}
e=n1/s;
g=n2/s;
printf(" normal fraction become %d/%d",e,g);
printf("\n");
int z=e/g;
int y=e%g;
int x=e-y;
printf(" mixed fraction become %d %d/%d",z,y,x);
}
/* Submitted by akshaykonoor363@gmail.com*/