Basic Data Types

  • + 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;
    

    }