Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <math.h>
- float modul(float x, float y) {
- if (fmod(x,y) < 0) return (fmod(x,y) + floor(y));
- return fmod(x,y);
- }
- void egy(float x, float y) {
- printf("1/%.f", ceil(y/x));
- if (modul(-y,x) != 0.0) {
- printf(" + ");
- egy(modul(-y,x), y*ceil(y/x));
- }
- }
- int main()
- {
- float x, y;
- printf ("Unesite brojilac i imenilac razlomka: ");
- scanf ("%f %f",&x, &y);
- egy(x,y);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement