MHB No, this is not correct. The answer should be "Infix to Postfix: a*b/c+d/e/f

  • Thread starter Thread starter needOfHelpCMath
  • Start date Start date
AI Thread Summary
The discussion centers around converting the infix expression a*b/c+d/e/f into postfix notation. The correct postfix expression is identified as ab*c/de/f/+. This is explained by the fact that multiplication (*) and division (/) have the same precedence and are evaluated from left to right. The evaluation of the original expression is clarified as ((a*b)/c)+((d/e)/f), which aligns with the resulting postfix format. The user expresses gratitude for the clarification of their mistakes.
needOfHelpCMath
Messages
70
Reaction score
0
Code:
Here is my problem a*b/c+d/e/f:
*there is no code because professor ask me do hand write it out*

My answer: abc*/def//+is this correct?
 
Technology news on Phys.org
needOfHelpCMath said:
Code:
Here is my problem a*b/c+d/e/f:
*there is no code because professor ask me do hand write it out*

My answer: abc*/def//+is this correct?

Hi needOfHelpCMath! (Smile)

It should be: [M]ab*c/de/f/+[/M]

That's because * and / have the same priority and are evaluated left to right.
So the expression is evaluated as [M]((a*b)/c)+((d/e)/f)[/M].
The postfix expression reflects that.
 
I like Serena said:
Hi needOfHelpCMath! (Smile)

It should be: [M]ab*c/de/f/+[/M]

That's because * and / have the same priority and are evaluated left to right.
So the expression is evaluated as [M]((a*b)/c)+((d/e)/f)[/M].
The postfix expression reflects that.

thank you very much clarifies my mistakes!
 
Dear Peeps I have posted a few questions about programing on this sectio of the PF forum. I want to ask you veterans how you folks learn program in assembly and about computer architecture for the x86 family. In addition to finish learning C, I am also reading the book From bits to Gates to C and Beyond. In the book, it uses the mini LC3 assembly language. I also have books on assembly programming and computer architecture. The few famous ones i have are Computer Organization and...
I have a quick questions. I am going through a book on C programming on my own. Afterwards, I plan to go through something call data structures and algorithms on my own also in C. I also need to learn C++, Matlab and for personal interest Haskell. For the two topic of data structures and algorithms, I understand there are standard ones across all programming languages. After learning it through C, what would be the biggest issue when trying to implement the same data...

Similar threads

Replies
1
Views
4K
Replies
3
Views
1K
Replies
1
Views
1K
Replies
14
Views
5K
Replies
10
Views
941
Replies
2
Views
2K
Back
Top