Basic Data Types

Sort by

recency

|

1520 Discussions

|

  • + 0 comments

    You can do it too. Its important that the different type of values and by char must separate it:

        int i;
        long l;
        char ch;
        float f;
        double d;
        scanf("%d %ld %c %f %lf", &i, &l, &ch, &f, &d);
        printf("%d\n%ld\n" "%c\n" "%.3f\n%.9lf\n", i, l, ch, f, d);
    
  • + 0 comments

    code in cpp: use fixed<

    #include <iostream>
    #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<<b<<endl<<c<<endl<<fixed<<setprecision(3)<<d<<
        endl<<fixed<<setprecision(9)<<e<<endl;
        
        return 0;
    }
    
  • + 0 comments

    for negative sign what to do

  • + 0 comments

    https://trafficridermod.com.in/

    nt main() { // Declare variables for each data type int i; long l; char ch; float f; double d;

    // Read input values scanf("%d %ld %c %f %lf", &i, &l, &ch, &f, &d);

    // Print each value on a new line printf("%d\n", i); // Print int printf("%ld\n", l); // Print long printf("%c\n", ch); // Print char printf("%.3f\n", f); // Print float with 3 decimal places printf("%.9lf\n", d); // Print double with 9 decimal places

    return 0; }

  • + 0 comments

    include

    int main() { // Declare variables for each data type int i; long l; char ch; float f; double d;

    // Read input values
    scanf("%d %ld %c %f %lf", &i, &l, &ch, &f, &d);
    
    // Print each value on a new line
    printf("%d\n", i);          // Print int
    printf("%ld\n", l);         // Print long
    printf("%c\n", ch);         // Print char
    printf("%.3f\n", f);        // Print float with 3 decimal places
    printf("%.9lf\n", d);       // Print double with 9 decimal places
    
    return 0;
    

    }