I am a beginner in computers, i would like to be assisted in writing a simple program that inputs a fraction in the form of a/b and c/d and culculates the sum and returns the answer in the simlest form as in p/q.
Notes
do not allow zero as the denomenator
#include<stdio.h>
int numerator a, denomenator b, , second numerator c, second denomenator d, first new numerator x, second new numerator y, new denomenator bd, sum of first new numerator x and second new numerator y p, simplest form of bd, q, ;
main()
{
printf("\nËnter value for the numerator a");
scanf("%d",&a);
if(numerator a==3)
{
printf("Enter value for denomenator b\n");
scanf("%d",&b);
if(denomenator b==4)
{
else
{
If (denomenator is 0)
printf("go to again");
printf("\nËnter value for the second numerator c");
scanf("%d",&c);
if(numerator c==5)
printf("\nËnter value for the second denomenator d");
scanf("%d",&d);
If (denomenator d==3)
{
else
{
If (denomenator is 0)
printf("go to again");
a/b + c/d
bd= b*d
x== bd/b*a
y== bd/d*c
p== x+y
if (p>= bd)
printf("The whole number is %d, p/bd);
printf("The remainder is %d, p%bd);
}
else
{
if (p%ab==q)
printf("The remainder is %d, p%q)
}
else
{
printf("The total sum is %d, p/q);
}
return [o]
Lookin forward to your prompt and positive response.
thanks