We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
  • HackerRank Home

    HackerRank

  • |
  • Prepare
  • Certify
  • Compete
  • Hiring developers?
  1. Prepare
  2. Linux Shell
  3. Bash
  4. Arithmetic Operations

Arithmetic Operations

Problem
Submissions
Leaderboard
Discussions
Editorial
Tutorial

A mathematical expression containing +,-,*,^, / and parenthesis will be provided. Read in the expression, then evaluate it. Display the result rounded to decimal places.

Constraints

All numeric values are <= 999.

Sample Input

Sample Input 1

5+50*3/20 + (19*2)/7

Sample Input 2

-105+50*3/20 + (19^2)/7

Sample Input 3

(-105.5*7+50*3)/20 + (19^2)/7

Sample Output

Sample Output 1

17.929

Sample Output 2

-45.929

Sample Output 3

 22.146

Author

PRASHANTB1984

Difficulty

Medium

Max Score

3

Submitted By

51903

Need Help?


View tutorial
View discussions
View editorial
View top submissions

rate this challenge

MORE DETAILS

Download problem statement
Download sample test cases
Suggest Edits
  • Blog
  • Scoring
  • Environment
  • FAQ
  • About Us
  • Support
  • Careers
  • Terms Of Service
  • Privacy Policy