Quiz on Type Conversions

Let’s see how well you understand type conversions in D.

1

Consider the following program:

import std.stdio;

void main() {
    double sum = 2.5; 
    int increment = 2; 
    sum += increment;

    write(sum);
}

The output of the above program will be?

A)

Error: Incompatible types

B)

2.5

C)

4.5

D)

None of the above

Question 1 of 50 attempted

Get hands-on with 1400+ tech skills courses.