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
Click For 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!
 
Learn If you want to write code for Python Machine learning, AI Statistics/data analysis Scientific research Web application servers Some microcontrollers JavaScript/Node JS/TypeScript Web sites Web application servers C# Games (Unity) Consumer applications (Windows) Business applications C++ Games (Unreal Engine) Operating systems, device drivers Microcontrollers/embedded systems Consumer applications (Linux) Some more tips: Do not learn C++ (or any other dialect of C) as a...

Similar threads

Replies
9
Views
3K
  • · Replies 18 ·
Replies
18
Views
3K
  • · Replies 1 ·
Replies
1
Views
4K
  • · Replies 3 ·
Replies
3
Views
1K
  • · Replies 1 ·
Replies
1
Views
1K
  • · Replies 10 ·
Replies
10
Views
1K
  • · Replies 14 ·
Replies
14
Views
5K
  • · Replies 7 ·
Replies
7
Views
1K
  • · Replies 0 ·
Replies
0
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K