C++ expressions.

Q19. Write the C++ equivalent expressions for the following:

  1. volume = 3.1459 r2h / 3
  2. Fn = 0.5 if x = 30
  3. fn = 0.9 if x = 60

Ans.(1). volume = (3.1459*r*r*h) / 3 ;

Ans.(2). Fn = x==30 ? 0.5 : 0;

Ans.(3). fn = x==60 ? 0.9 : 0 ;

Leave a Reply

Your email address will not be published. Required fields are marked *

978 Views
%d bloggers like this: