# How to create a program using code block involving fraction??

Status
Not open for further replies.

#### Ashieboy

##### Member level 1 Write a program that accepts from the user two fractions Fraction1
and Fraction2; display them, then asks the user the arithmetic
operation to be performed on the two fractions, either addition (+)
or subtraction (-).
The program uses the following functions to accomplish the tasks
above:
a) inputfrac: This function accepts from the user four numbers n1, d1, n2 and d2; then
return it to the main program.
b) fraction: This function is a void function that accept the two fractions using pass by
value method and then display the two fractions on to the monitor.
c) addfrac: This function is a void function that accept the two fractions using pass by
value method, calculates and display their sum. Optional: The result must be in its
simplest fraction form.
d) subfrac: This function accept the two fractions using pass by address method, find
and return their difference to the main() program. The main program then display
the difference. Optional: The result must be in its simplest fraction form.
These functions must be called from the main() program.

#### deepsetan Write a program that accepts from the user two fractions Fraction1
and Fraction2; display them, then asks the user the arithmetic
operation to be performed on the two fractions, either addition (+)
or subtraction (-).
The program uses the following functions to accomplish the tasks
above:
a) inputfrac: This function accepts from the user four numbers n1, d1, n2 and d2; then
return it to the main program.
b) fraction: This function is a void function that accept the two fractions using pass by
value method and then display the two fractions on to the monitor.
c) addfrac: This function is a void function that accept the two fractions using pass by
value method, calculates and display their sum. Optional: The result must be in its
simplest fraction form.
d) subfrac: This function accept the two fractions using pass by address method, find
and return their difference to the main() program. The main program then display
the difference. Optional: The result must be in its simplest fraction form.
These functions must be called from the main() program.

Hi,

Don't ask for a solution. It's better if you can show us some of your code or work that you may have done.

Status
Not open for further replies.

Replies
2
Views
1K
Replies
0
Views
1K
Replies
7
Views
3K
Replies
2
Views
1K
Replies
0
Views
1K