C# Programming - Datatypes - Discussion
Discussion Forum : Datatypes - General Questions (Q.No. 9)
9.
Which of the following statements is correct about the C#.NET code snippet given below?
short s1 = 20;
short s2 = 400;
int a;
a = s1 * s2;
Discussion:
4 comments Page 1 of 1.
VISHWANATH said:
1 decade ago
As the value 8000 is in the limits of short integer we can easily get that.
But if ever the situation is such that the value exceeds the limit of the data type taken then that goes to wrap from the other extreme.
But if ever the situation is such that the value exceeds the limit of the data type taken then that goes to wrap from the other extreme.
Toetian said:
4 years ago
No error a = 160000.
But if you used a bigger number you will get error such as.
Constant value 'value' cannot be converted to a 'type'.
But if you used a bigger number you will get error such as.
Constant value 'value' cannot be converted to a 'type'.
Aarthi said:
1 decade ago
s1 = 20
s2 = 400
int a
a = s1*s2
a=20*400
a=8000
Value of a is 8000
s2 = 400
int a
a = s1*s2
a=20*400
a=8000
Value of a is 8000
Raj said:
1 decade ago
If the value of s1=400 and s2=400 then what will happen.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers