C# Programming - Functions and Subroutines - Discussion
Discussion Forum : Functions and Subroutines - General Questions (Q.No. 13)
13.
What will be the output of the C#.NET code snippet given below?
namespace IndiabixConsoleApplication
{
class SampleProgram
{
static void Main(string[ ] args)
{
object[] o = new object[] {"1", 4.0, "India", 'B'};
fun (o);
}
static void fun (params object[] obj)
{
for (int i = 0; i < obj.Length-1; i++)
Console.Write(obj[i] + " ");
}
}
}
Discussion:
6 comments Page 1 of 1.
Sotheanat said:
6 years ago
What about letter 'B'?
It is not printed out why?
It is not printed out why?
Kiran said:
1 decade ago
You can print b if we changes the condition in the for loop, as
i <= obj.Length - 1. Will print you b.
i <= obj.Length - 1. Will print you b.
Darshana said:
1 decade ago
What about b?
Min said:
1 decade ago
@Mot.
4. 0 == 4, and it's stored as 4. There is no trailing zero when stored. And the default string output of 4 is "4".
4. 0 == 4, and it's stored as 4. There is no trailing zero when stored. And the default string output of 4 is "4".
Ashish said:
1 decade ago
This is correct
object o1 = 4.50;
console.Write(o1);
than output=>4.5
object o1 = 4.50;
console.Write(o1);
than output=>4.5
Mot said:
1 decade ago
Not getting ... why not float value is 4.0 ?
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers