C# Programming Questions and Answers
Which of these method returns a smallest whole number greater than or equal to variable X?
Ciel(double X) returns the smallest whole number greater than or equal to variable X.
Which of these methods is a rounding function of Math class?
Round() rounds up a variable to nearest integer
What will be the output of the given code snippet?
class Program
{
staticvoid Main(string[] args)
{
double x =3.14;
int y =(int) Math.Abs(x);
Console.WriteLine(y);
}
}
Answer: Option (B)
Which among the given classes provides types of rounding functions?
Answer: Option (A)
What will be the output of the given code snippet?
class Program
{
staticvoid Main(string[] args)
{
double x =3.14;
int y =(int) Math.Floor(x);
Console.WriteLine(y);
}
}
double Floor(double X) returns the largest whole number less than or equal to variable X. Here, the smallest whole number less than 3.14 is 3.
Output: 3