Output writing based on summation of different data types. – Computer Sir Ki Class

Login


Lost your password?

Don't have an account ?
Register (It's FREE) ×
  

Login
[lwa]



Solved Problem! #JAVA#3852    siteicon   siteicon  

Problem Statement - Output writing based on summation of different data types.

Summation of different data types.

TC++ #3852

Solution


Run Output

60.0

int n=12; double d=12.0; float f=12.0f; byte b=12; char c=12;
Values of different data types have been initialised.

System.out.println(n+d+f+b+c);
The summation can be done while passing as argument also. The largest of the type here will be resulted. So this sum would be 60.0 and not 60.

Common Errors

  • Some time students erroneously write it as 60 and not 60.0


Suggested Filename(s): BooleanType.java



Share

sunmitra| Created: 19-Mar-2018 | Updated: 20-Mar-2018|






Back