Here in this article we are going to print a double number in scientific as well as fixed notation . There is a keyword

**fixed**. By using this keyword we can easily print a number in**fixed notation**and for the**scientific**notation we can use**scientific keyword**. These are predefined keywords which are defined in**iostream library file**. We can also fix the number after point (.) in the**fixed notation**. for this we can use**precision(x)**,here value of x denote how many numbers we want after point .

__example :-__#include <iostream>

#include <cstdio>

using namespace std;

int main() {

double a=123.4589;

double b=1.0e6;

double c=1256.32;

// fixed notation

cout<<"The fixed notation of the numbers are"<<endl;

cout<<fixed<<a<<" "<<b<<" "<<c<<endl;

// scientific notation

cout<<"The scientific notation of the numbers are"<<endl;

cout<<scientific<<a<<" "<<b<<" "<<c<<endl;

// fix numbers after dot (.)

// let's we want only 2 numbers

// after dot(.)

cout.precision(2);

cout<<"The numbers are"<<endl;

cout<<fixed<<a<<" "<<b<<" "<<c<<endl;

return 0;

}

__output:-__The fixed notation of the numbers are

123.458900 1000000.000000 1256.320000

The scientific notation of the numbers are

1.234589e+02 1.000000e+06 1.256320e+03

The numbers are

123.46 1000000.00 1256.32

__Recommended Post:__

__Cracking the coding interview:-__

__Array and string:-__

__Tree and graph:-__

__Hackerearth Problems:-__

- Very Cool numbers | Hacker earth solution
- Vowel Recognition | Hackerearth practice problem solution
- Birthday party | Hacker earth solution
- Most frequent | hacker earth problem solution
- program to find symetric difference of two sets
- cost of balloons | Hacker earth problem solution
- Chacha o chacha | hacker earth problem solution
- jadu and dna | hacker earth solution
- Bricks game | hacker earth problem
- Anti-Palindrome strings | hacker earth solution
- connected components in the graph | hacker earth data structure
- odd one out || hacker earth problem solution
- Minimum addition | Hackerearth Practice problem
- The magical mountain | Hackerearth Practice problem
- The first overtake | Hackerearth Practice problem

__Hackerrank Problems:-__- Playing With Characters | Hackerrank practice problem solution
- Sum and Difference of Two Numbers | hackerrank practice problem solution
- Functions in C | hackerrank practice problem solution
- Pointers in C | hackerrank practice problem solution
- Conditional Statements in C | Hackerrank practice problem solution
- For Loop in C | hackerrank practice problem solution
- Sum of Digits of a Five Digit Number | hackerrank practice problem solution
- 1D Arrays in C | hackerrank practice problem solution
- Array Reversal | hackerrank practice problem solution
- Printing Tokens | hackerrank practice problem solution
- Digit Frequency | hackerrank practice problem solution
- Calculate the Nth term | hackerrank practice problem solution

__Data structure:-__

- Program to find cycle in the graph
- Implementation of singly link list
- Implementation of queue by using link list
- Algorithm of quick sort
- stack by using link list
- program to find preorder post order and inorder of the binary search tree
- Minimum weight of spanning tree
- Preorder, inorder and post order traversal of the tree

__Key points:-__

- How to set limit in the floating value in python
- What is boolean data type
- How to print any character without using format specifier

Must check this:-__ MCQs:-__

## 0 Comments