#include <stdio.h>
#include <conio.h>
struct kesir1{
int pay,payda;
};
struct kesir2{
float k1,k2;
}x;
float toplama (struct kesir1 a1,struct kesir1 b1)
{
float top;
x.k1=(float)a1.pay/a1.payda;
x.k2=(float)b1.pay/b1.payda;
top=x.k1+x.k2;
return top;
}
float fark (struct kesir1 a2,struct kesir1 b2)
{
float cik;
x.k1=(float)a2.pay/a2.payda;
x.k2=(float)b2.pay/b2.payda;
cik=x.k1-x.k2;
return cik;
}
float carp (struct kesir1 a3,struct kesir1 b3)
{
float carpma;
x.k1=(float)a3.pay/a3.payda;
x.k2=(float)b3.pay/b3.payda;
carpma=x.k1*x.k2;
return carpma;
}
float bolme (struct kesir1 a4,struct kesir1 b4)
{
float bol;
x.k1=(float)a4.pay/a4.payda;
x.k2=(float)b4.pay/b4.payda;
bol=x.k1/x.k2;
return bol;
}
float ensade (struct kesir1 a5,struct kesir1 b5)
{
float yenisayi;
int islem1,islem2;
islem1=a5.pay/b5.pay;
islem2=a5.payda/b5.payda;
yenisayi=(float)islem1/islem2;
return yenisayi;
}
main()
{
struct kesir1 a,b;
printf("birinici kesrin pay ve paydasini giriniz:");
scanf("%d %d",&a.pay,&a.payda);
printf("ikinci kesrin pay ve paydasini giriniz:");
scanf("%d %d",&b.pay,&b.payda);
printf("%.2f\n",toplama(a,b));
printf("%.2f\n",fark(a,b));
printf("%.2f\n",carp(a,b));
printf("%.2f\n",bolme(a,b));
printf("%.2f\n",ensade(a,b));
getch();
}