Create a free account on Computer Sir Ki Class and unlock access to valuable learning resources.
Exam Paper Downloads: After registering and logging in, you can download exam question papers in PDF format to practice and prepare for your exams.
Student Support: Get assistance with your doubts, queries, and questions related to your studies. Our support is here to help you understand topics and resolve your learning difficulties.
Register today and make your exam preparation easier and more effective!
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
The code has been copied automatically for you in the clipboard. After that open any of the service and press cntrl-v to paste in the given code area. Needs a bit of tweaking as per the link.
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