Logo 
Search:

C Programming Articles

Submit Article
Home » Articles » C Programming » Mathematics ProgramRSS Feeds

Program to add, subtract, multiply and divide rational numbers

Posted By: Julia Silva     Category: C Programming     Views: 9864

Program to add, subtract, multiply and divide rational numbers.

Code for Program to add, subtract, multiply and divide rational numbers in C Programming

#include<stdio.h>
#include<conio.h>
#include "rtnl.h"// included in attachmentvoid main()
{
    clrscr();
    Rational r1,r2,sum,sub,mul,div;
    printf("\nEnter the First Rational Number.");
    r1=getRational();

    printf("\nEnter the Second Rational Number.");
    r2=getRational();

    sum=addRational(r1,r2);
    sub=subtractRational(r1,r2);
    mul=multiplyRational(r1,r2);
    div=divideRational(r1,r2);

    printf("\nADDITION IS : ");
    displayRational(sum);

    printf("\nSUBTRACTION IS : ");
    displayRational(sub);

    printf("\nMULTIPLICATION IS : ");
    displayRational(mul);

    printf("\nDIVISION IS : ");
    displayRational(div);

    getch();
}
  
Share: 



Julia Silva
Julia Silva author of Program to add, subtract, multiply and divide rational numbers is from Salvador, Brazil.
 
View All Articles

 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!