8000 GitHub - SegundoRP/prefix-notation-string
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

SegundoRP/prefix-notation-string

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

Ruby Prefix Notation Evaluator

This program evaluates mathematical expressions in prefix notation.

How to run

  1. Clone this repository:
git clone git@github.com:SegundoRP/prefix-notation-string.git
cd prefix-notation-string
  1. Run the script:
ruby prefix_notation_algorithm.rb
  1. Enter the expression in prefix notation. Example:
Please enter a prefix notation expression:
+ + 12 16 * 10 4

Output:

Result: 68

Input and Output Examples

Input Output
9 9
+ 1 2 3
+ + 1 2 30 33
+ + 12 16 * 10 4 68

Assumptions and Limitations

  • The program assumes that the input is always valid and is in correct prefix notation.
  • No error handling is performed if the expression is invalid or contains operators without enough operands.
  • Only positive integers and the operators +, -, *, and / are supported.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

0