HackerRank C++ Basic Data Types

This Problem is of Basic Data Types
Print each element on a new line in the same order it was received as input. Note that the floating point value should be correct up to 3 decimal places and the double to 9 decimal places.

  1. #include <iostream>
  2. #include <cstdio>
  3. #include <iomanip>
  4. using namespace std;
  5. int main()
  6. {
  7. int integer;
  8. long long1;//by default int long
  9. long long long2; //by default int long long
  10. char character;
  11. float floatnumber;
  12. double doublenumber;
  13. cin>>integer;
  14. cin>>long1;
  15. cin>>long2;
  16. cin>>character;
  17. cin>>floatnumber;
  18. cin>>doublenumber;
  19. cout << setprecision(20) << integer<< endl;
  20. cout << setprecision(20) << long1<< endl;
  21. cout << setprecision(20) << long2<< endl;
  22. cout << setprecision(20) << character<< endl;
  23. cout << setprecision(20) << floatnumber<< endl;
  24. cout << setprecision(20) << doublenumber<< endl;
  25. return 0;
  26. }
Please click on the like button if it worked

Solution not working or have any suggestions? Please send an email to [email protected]

donate a cup of tea :)

Join Our Facebook Group

Share this solution


Codesadda.com is your home of programming solutions, tutorials, video tutorials and much more. Sign Up for our weekly newsletter to get update about new content.

Like us on Facebook | Connect with us on LinkedIn | Subscribe our Channel on Youtube