Write a C Program to convert Prefix into INFIX Expression.Here’s a Simple Program To Convert Prefix To Infix Notation using Stack in C Programming Language.
The Prefix notation is also known as Polish Notation.
The Reversed Prefix Expression is pushed on the Stack.
If the Stack is not Empty, then Pop the elements from the Stack
If the popped character is an Operator
Input Opening Parantheses ‘(‘ and print it on the console.
Display popped character from the Stack.
Input Closing Parantheses ‘)’ and print it on the console.
If the popped character is an empty space, then print it on the console.
Repeat the steps till the Prefix expression is not scanned completely.
Below is the source code for C Program to convert Prefix into INFIX Expression which is successfully compiled and run on Windows System to produce desired output as shown below :
FIRST RUN ::
Give an Expression = +++++abcde
Given Prefix Expression : +++++abcde
Infix Expression: ((((a+b)+c)+d)+e)
SECOND RUN ::
Give an Expression = +-435
Given Prefix Expression : +-435
Infix Expression: ((4-3)+5)
THIRD RUN ::
Give an Expression = ++a*bcd
Given Prefix Expression : ++a*bcd
Infix Expression: (a+((b*c)+d))
Prefix To Infix Example :
Algorithm :
Below is the source code for C Program to convert Prefix into INFIX Expression which is successfully compiled and run on Windows System to produce desired output as shown below :
SOURCE CODE : :
OUTPUT : :
need an explanation for this answer? contact us directly to get an explanation for this answer