C# Programming - Operators - Discussion

Discussion Forum : Operators - General Questions (Q.No. 7)
7.
Which of the following is the correct output for the C#.NET code snippet given below?
Console.WriteLine(13 / 2 + " " + 13 % 2); 
6.5 1
6.5 0
6 0
6 1
6.5 6.5
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
20 comments Page 2 of 2.

Sulabh Jain said:   1 decade ago
int/int = int.
float /int = float.

So 13 / 2 = 6.

13%2 remainder value = 1.

Somu Minajagi said:   1 decade ago
13/2 = 6.5 Decimal value = 6.
13%2 remainder value = 1.

Answer is : 6 1.

Shekar c said:   1 decade ago
Int is the default datatype so decimal value is neglected

answer : 6 1

Viviek said:   1 decade ago
A/b always output the Quotient.

A%b always output the remainder.

S.Malathi said:   1 decade ago
13/2 the ans is quotient and 13%2 the ans is remainder.

Ram said:   1 decade ago
13/2=6.5 Decimal value=6
13%2 remainder value=1
ans:61

Arvind said:   1 decade ago
Yes it may be that int is by default data type in c#.

Rishabh Shrotriya said:   1 decade ago
Thanks Shivakant yadav thanks for explanation.

Vishul said:   1 decade ago
6.5 and remainder is 1

Prashant said:   1 decade ago
Explain briefly.


Post your comments here:

Your comments will be displayed after verification.