I'm having trouble with my work some assistance would be appreciated

Write a program that reads two fractions such as 1/2 and 1/4 and computes and stores the sum, the difference, the product and the result of dividing one by the other in four other fractions, respectively. Display the four resulting fractions.

The following is a sample interaction between the user and the program:

Enter two fractions: 1/2 1/4

Sum fraction: 6/8

Difference: 2/8

Product: 1/8

Quotient: 4/2

Press any key to continue.

If n1/d1 and n2/d2 are the two fractions,

their sum is given by: n1 * d2 + n2 * d1 / d1 * d2

their difference is given by: n1 * d2 - n2 * d1 / d1 * d2

Product is: n1 * n2 / d1 * d2

Quotient: n1 * d2 / d1 * n2

-----------------------------------------------------------------

my code

#include <iostream>
#include <iomanip>
int main() {

int number1, number2; // Declare 2 integer variable number1 and number2
int sum, difference, product, quotient, remainder; // declare 5 int variables

// Prompt user for the two numbers
printf("Enter two integers (separated by space): ");
scanf_s("%d%d", &number1, &number2); // Use 2 %d to read 2 integers

// Do arithmetic Operations
sum = number1 + number2;
difference = number1 - number2;
product = number1 * number2;
quotient = number1 / number2;
remainder = number1 % number2;

printf("The sum, difference, product, quotient and remainder of %d and %d are %d, %d, %d, %d, %d.\n",
number1, number2, sum, difference, product, quotient, remainder);

// Increment and Decrement
++number1; // Increment the value stored in variable number1 by 1
// same as "number1 = number1 + 1"
--number2; // Decrement the value stored in variable number2 by 1
// same as "number2 = number2 - 1"
printf("number1 after increment is %d.\n", number1);
printf("number2 after decrement is %d.\n", number2);

quotient = number1 / number2;
printf("The new quotient of %d and %d is %d.\n", number1, number2, quotient);

system("pause");
return 0;
}



please help revise if possible





> Write a program that reads two fractions
1
2
// Prompt user for the two numbers
printf("Enter two integers (separated by space): ");
¿did you bother to read the assignment?
Topic archived. No new replies allowed.