Basic Data Types

Sort by

recency

|

1549 Discussions

|

  • + 0 comments
    #include <cstdio>
    #include <iomanip>
    using namespace std;
    
    int main() {
        // Complete the code.
        int a;
        long b;
        char c;
        float d;
        double e;
        cin>>a>>b>>c>>d>>e;
        cout<<a<<endl;
        cout<<b<<endl;
        cout<<c<<endl;
        cout<<fixed<<setprecision(3)<<d<<endl;
        cout<<fixed<<setprecision(9)<<e<<endl;;
        return 0;
    }
    

    We have to add #inlude our code for using setpricion

  • + 0 comments

    include

    using namespace std; int main() {

    int a; long long b; char c; float d; double e; cin >> a >> b >> c >> d >> e;

    cout << a << endl ;
    

    cout << b << endl; cout << c << endl; cout << fixed << setprecision(3) << d << endl; cout << fixed << setprecision(9) << e << endl; return 0; }

  • + 0 comments

    Here is Basic Data types solution in c++ - https://programmingoneonone.com/hackerrank-basic-data-types-solution-in-cpp.html

  • + 0 comments

    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", a);
    printf("%ld\n", b);
    printf("%c\n", c);
    printf("%.3f\n", d);    
    printf("%.9lf\n", e);    
    return 0;
    

    }

  • + 0 comments
    #include <iostream>
    #include <cstdio>
    using namespace std;
    
    int main() {
            int x;
            long y;
            char a;
            float f;
            double z;
            cin>>x>>y>>a>>f>>z;
            cout<<x<<endl<<y<<endl<<a;
            printf("\n%.3f \n", f);
                    printf("%.9lf", z);
            return 0;
    }