Multiple choice

Which is the correct format for type casting in C? (Consider the following program code.) include<stdio.h> main() {int x=100,y=7; float z;z=……..; prinf(“z=%f”,z);}

  1. float(x/y)

  2. (float)x/y

  3. (float)(x/y)

  4. x/y

  5. none of these

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

The correct format for type casting in C is (data-type)values i.e. (float)x/y