Basic Data Types

Sort by

recency

|

1562 Discussions

|

  • + 0 comments
    int main() {
        /* Enter your code here. Read input from STDIN. Print output to STDOUT */   
        int a;
        long b;
        char c;
        float d;
        double e;
    		
    		// Take multiple input
        scanf("%d %ld %c %f %lf", &a, &b, &c, &d, &e);
        
    		// print output
    		// to make it more readable separate the a, b, c
        printf("%d\n%ld\n%c\n", a, b, c);
        printf("%.3f\n", d);
        printf("%.9lf\n", e);
        
        return 0;
    }
    
  • + 0 comments

    include

    using namespace std;

    int main() {

    // declare variable(s)
    int i;
    long ln;
    char c;
    float f;
    double d;
    
    // scan input
    scanf("%d %ld %c %f %lf", &i, &ln, &c, &f, &d);
    
    // print output
    printf("%d\n", i);
    printf("%ld\n", ln);
    printf("%c\n", c );
    printf("%f\n", f);
    printf("%lf", d);
    
    return 0;
    

    }

  • + 0 comments

    include

    include

    using namespace std;

    int main() { int i; long l; char c; float f; double d;

    // GiriÅŸ alma
    scanf("%d %ld %c %f %lf", &i, &l, &c, &f, &d);
    
    // Formatlı çıktı
    printf("%d\n", i);           // int
    printf("%ld\n", l);          // long
    printf("%c\n", c);           // char
    printf("%.3f\n", f);         // float (3 basamak)
    printf("%.9lf\n", d);        // double (9 basamak)
    
    return 0;
    

    }

  • + 0 comments

    int main() { // Complete the code. int a; long b; char c; float d; double e;

    cin >> a >> b >> c >> d >> e;
    cout << a << endl << b << endl << c << endl;
    printf("%.3f\n", d);
    printf("%.9f\n", e); 
    
    return 0;
    

    }

  • + 1 comment
    #include <iostream>
    #include <iomanip>
    using namespace std;
    int main() {
        int i;
        long l;
        char c;
        float f;
        double d;
        cin >> i >> l >> c >> f >> d;
        cout << i << endl;
        cout << l << endl;
        cout << c << endl;
        cout << fixed << setprecision(3) << f << endl;
        cout << fixed << setprecision(9) << d << endl;
        return 0;
    }