## Algorithm

Problem Name: beecrowd | 1958

# Scientific Notation

By M.C. Pinto, UNILA Brazil

Timelimit: 1

Floating point numbers can be very long to show. In these cases, it is convenient to use the scientific notation.

You must write a program that, given a floating point number, shows this number in scientific notation: always show the mantissa sign; always show the mantissa with 4 decimal places; use the character 'E' between the mantissa and the exponent; always show the exponent sign; and show the exponent with at least 2 digits.

## Input

The input is a double precision floating point number X (according to the IEEE 754-2008 standard). There will never be a number with more than 110 characters long and more than 6 decimal places.

## Output

The output is the number X in a single line using the scientific notation detailed above. See the examples below.

 Input Samples Output Samples 3.141592 +3.1416E+00

 1.61803 1.618

 602214085774747474747474 6.0221e+23

 -2.7e-05 -2.7e-05

 -100000000000000000000000000000000000000000000000000000000000000000000000000000000

## Code Examples

### #1 Code Example with C++ Programming

```Code - C++ Programming```

``````
#include <iostream>
#include<stdio.h>
#include<string.h>
using namespace std;

int main() {
long double n;
char ar[111];
cin >> n;
sprintf(ar,"%LE",n);
if(ar[0]!='-') cout <<"+";
printf("%.4LE\n",n);
return 0;
}
``````
Copy The Code &

Input

cmd
3.141592

Output

cmd
+3.1416E+00

### #2 Code Example with Javascript Programming

```Code - Javascript Programming```

``````
var lines = input.split('\n');
var prompt = function(texto) { return lines.shift();};
var Nstring = prompt();
var Nfull = parseFloat(Nstring);

N = Nfull.toExponential(4);
N = N.toString().replace(/e/, "E");
if (Nfull >= 0) {
N = "+" + N;
}

var exp = N.slice(9);
if (exp  <  10) {
N = N.substring(0, N.length - 1) + "0" + N.substring(N.length - 1, N.length);
}

if (Nstring == "-0") {
console.log("-0.0000E+00");
} else {
console.log(N);
}
``````
Copy The Code &

Input

cmd
3.141592

Output

cmd
+3.1416E+00