Output writing based on summation of different data types. – CSKC
Sign In

Search

Solved Problem! #JAVA#3852    siteicon   siteicon  

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

Summation of different data types.

TC++ #3852

×

Ask AI About This Code

Default Prompt that is passed along with the code is given below, You can write your own prompt if you so desire.



×

Test Java

Solution


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

Created: 19-Mar-2018 23:56 | Updated: 22-Mar-2026 20:17|