Basic Data Types

Sort by

recency

|

1534 Discussions

|

  • + 0 comments

    "The hands-on coding sessions made the concepts easy to apply. I’ve never felt more confident with AI tools." Generative AI Training In Hyderabad

  • + 0 comments

    **Solution by Using Cout and Cin **

    #include <iostream>
    #include <cstdio>
    #include<iomanip>
    using namespace std;
    
    int main() {
        int int1;
        long long1;
        char char1;
        float float1;
        double double1;
        
        cin>>int1>>long1>>char1>>float1>>double1;
        
        cout<<int1<<endl;
        cout<<long1<<endl;
        cout<<char1<<endl;
        cout<<fixed<<setprecision(6)<<float1<<endl;
        cout<<fixed<<setprecision(9)<<double1;
        return 0;
    }
    
  • + 0 comments
    #include <iostream>
    #include <bits/stdc++.h>
    
    int main()
    {
    int a;
    long b;
    char c;
    float d;
    long e;
    
    cin>>a>>b>>c>>d>>e;
    cout<<a<<'\n'<<b<<'\n'<<c<<'\n'<<setprecision(10)<<d<<'\n'<<setprecision(20)<<e;  //we need precision for int precision and hidden test cases
    
    return 0;
    }
    
  • + 0 comments
    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%f\n%lf", a, b, c, d, e);
        return 0;
    }
    
  • + 0 comments

    Perhaps Hackerrank people who created this course need to pass the certification themselfs before being hired.

    This is NOT C++ this is C:

    char ch;
    double d;
    scanf("%c %lf", &ch, &d);