Mixed Fractions

Given an improper fraction (as the numerator $N$ and the denominator $D$), determine and print it in…

Click here to read the complete problem statement.


If you need help solving this problem, mention your approach and ask specific questions. Please avoid sharing your code and asking the Community to figure out “what’s wrong”.

Where is problem??working in other python3 ide but not working here:
N = int(input())
D = int(input())
a = N // D
b = N % D
print (‘The mixed number is {} {} {}’.format(a, b, D))

error saying: runtime error

N,D=map(int,input().split())
a = N // D
b = N % D
print (a,b,D)

1 Like

@bengalsha, nobody told you to print "The mixed number is ", Just print the numbers as they are shown in the samples.

1 Like
n=int(input())
d=int(input())
a=n//d
b=n%d
print(a,'',b,'',d)

Can you please state for which problem you are facing this problem? Is it for the Mixed Fraction problem?

@emam_mahadi This looks like a solution for the problem Mixed Fraction.

You are reading the two numbers with two calls to input(). This would have worked if the two numbers were on separate lines.

Please try this instead:

n, d = map(int, input().split())

[REDACTED]
**

did this, and accepted
**

If your code has already been accepted, I suggest not to share it in the community.
Please remove your solution from here.

(This is an wiki post to face this kind of situations. You can edit and make this post better if you wish to.)

#include<stdio.h>
int main()
{
    int a,b,c,d;
    scanf("%d\n%d",&a,&b);
    if(a>b){
    c=a-b;
    d=a/b;
    printf("%d %d %d",d,c,b);
    }
    else if(b>a){
        printf("error\n");
    }
    return 0;
}

where is the problem?

Please update the problem statement