Breaking News: Grepper is joining You.com. Read the official announcement!
Check it out

rational numbers as abstract data type

Bishwo Mohan answered on March 18, 2023 Popularity 1/10 Helpfulness 1/10

Contents


More Related Answers

  • are functions abstract data types
  • what is an abstract data type
  • define abstract data type
  • abstract data type
  • Examples Of Abstract Data Types

  • rational numbers as abstract data type

    0

    #include struct rational{

    int num;

    int den; };

    struct rational sum(struct rational a, struct rational b) {

    struct rational c;

    c.num= a.num*b.den+b.num*a.den; c.den=a.num*b.den;

    return c;

    }

    int main() {

    struct rational x,y,z;

    printf("Enter all values:");

    scanf("%d %d %d %d",&x.num,&x.den,&y.num,&y.den); z=sum(x,y);

    printf("The sum is %d/%d",z.num,z.den);

    return 0; } 

    Popularity 1/10 Helpfulness 1/10 Language whatever
    Source: Grepper
    Link to this answer
    Share Copy Link
    Contributed on Mar 18 2023
    Bishwo Mohan
    0 Answers  Avg Quality 2/10


    X

    Continue with Google

    By continuing, I agree that I have read and agree to Greppers's Terms of Service and Privacy Policy.
    X
    Grepper Account Login Required

    Oops, You will need to install Grepper and log-in to perform this action.