Given a positive decimal number, find the simple exponential notation (x = a·10^b) of the given number.
Input : 100.0 Output : 1E2 Explanation: The exponential notation of 100.0 is 1E2. Input :19 Output :1.9E1 Explanation: The exponential notation of 16 is 1.6E1.
The simplest way is to find the position of the first non zero digit and the position of the dot. The difference between that positions is the value of b (if the value is positive you should also decrease it by one).
Below is the implementation of the above approach:
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
- Total no of 1’s in numbers
- Find all possible coordinates of parallelogram
- Check if a number is power of k using base changing method
- Power Set
- Operators in C / C++
- Number of Permutations such that no Three Terms forms Increasing Subsequence
- Check if the first and last digit of the smallest number forms a prime
- Print all substring of a number without any conversion
- Complement of a number with any base b
- Check if Decimal representation of an Octal number is divisible by 7