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. C++
  3. Introduction
  4. Basic Data Types
  5. Discussions

Basic Data Types

Problem
Submissions
Leaderboard
Discussions
Editorial

Sort 1384 Discussions, By:

recency

Please Login in order to post a comment

  • kunalbang2
    4 days ago+ 0 comments

    /* The Question Should Have Specified That We Need To Set Precision For The Values Of Float & Double, I just wrote the simpler code like everyone and It did not work on the other test questions, I tried the questions 4-5 Times until I realised My code was not printing decimal values after some 3 or 4 digits then I came to know that I do have to set a precision value which I ultimately had to and I didn't how to, Googled It, learned something new from this question, here's my solution. */

    include

    include

    include

    using namespace std; int main() { int x; long y; char a; float z; long double d; cin >> x; cin >> y; cin >> a; cin >> z; cin >> d; cout << x <<"\n"; cout << y <<"\n"; cout << a <<"\n"; cout << fixed << setprecision(3)<< z <<"\n"; cout << fixed << setprecision(9)<< d <<"\n";

    return 0;
    

    }

    0|
    Permalink
  • nikhilkumar2450
    2 weeks ago+ 2 comments

    c++

    #include <iostream>
    #include <cstdio>
    #include <iomanip>
    using namespace std;
    
    int main() {
        // Complete the code.
        int a;
        long b;
        char ch;
        float f;
        double d;
        std::cin>>a>>b>>ch>>f>>d;
        std::cout<<a<<endl;
        std::cout<<b<<endl;
        std::cout<<ch<<endl;
        std::cout<<fixed<<setprecision(3)<<f<<endl;
        std::cout<<fixed<<setprecision(9)<<d<<endl;
        return 0;
    }
    
    -1|
    Permalink
  • infocus619
    2 weeks ago+ 0 comments

    lolooking for softwere courses:

    [Data Science Programs In Chennai](https://shiash.com/data-science-program.php )

    [Internship Programs In Chennai](https://shiash.com/internship.php )

    -1|
    Permalink
  • rawatshivam9041
    3 weeks ago+ 0 comments

    include

    using namespace std; int main() { int x; cin >> x; long b; cin >> b; char a; cin >> a; float c; cin >> c; double d; cin >> d; cout << x << endl; cout << b << endl; cout << a << endl; cout << c << endl; cout << d << endl; return 0; }

    0|
    Permalink
  • 2016mubeena
    3 weeks ago+ 0 comments

    include

    include

    include

    using namespace std;

    int main() { int a; long b; char c; float d; double e;

    scanf("%d %ld %c %f %lf", &a, &b, &c, &d, &e);
    printf("%d\n%ld\n%c\n%.3f\n%.9lf\n", a, b, c, d, e);
    
    return 0;
    

    }

    0|
    Permalink
Load more conversations

Need Help?


View editorial
View top submissions
  • Blog
  • Scoring
  • Environment
  • FAQ
  • About Us
  • Support
  • Careers
  • Terms Of Service
  • Privacy Policy