Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

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

Status
Not open for further replies.

Ashieboy

Member level 1
Joined
Feb 13, 2013
Messages
34
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Location
Malaysia
Activity points
1,508
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

Advanced Member level 4
Joined
May 8, 2013
Messages
119
Helped
6
Reputation
12
Reaction score
5
Trophy points
1,298
Location
Malaysia
Activity points
2,137
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.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top