hellow everyone,

can u please help me.... just a code fragment in C... the program is designed to add fraction... the user should input like this:

enter the fraction to be added: 1/2 1/4
the answer is: 3/4...

tnx... :)

int main ( ) {
    // your code here
    return 0;
}

There's a fragment.

Do you even understand how to do this on paper?

Hey its simple you just need to do the same working as you would do on a paper. Take the fraction as a string and break it into tokens with delimiter as "/" . Now you get the numbers as characters. Just convert them into integers and use them in the same way as you would use them on paper.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.