Create a Console App that produces the following output: Math.Abs( 7.5 ) = x Mat
ID: 3768438 • Letter: C
Question
Create a Console App that produces the following output:
Math.Abs( 7.5 ) = x
Math.Floor( 7.5 ) = x
Math.Abs( 0.0 ) = x
Math.Ceiling( 0.0 ) = x
Math.Abs( -6.4 ) = x
Math.Ceiling( -6.4 ) = x
Math.Ceiling( -Math.Abs( -8 + Math.Floor( -5.5 ) ) ) = x
Math.Ceiling( -6.4 ) * Math.Ceiling( -6.4 ) = x
Math.Floor( 7.5 ) + Math.Floor( 7.5 ) / Math.Floor( 1.5 ) = x
Math.Floor( 7.5 ) / Math.Floor( 7.5 ) + Math.Floor( 1.5 ) = x
Where x is the correct answer.
I need this program to be in C# and runnable in Visual Studio
Explanation / Answer
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Chegg
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine(Math.Abs( 7.5 ));
Console.WriteLine(Math.Floor( 7.5 ));
Console.WriteLine(Math.Abs( 0.0 ));
Console.WriteLine(Math.Ceiling( 0.0));
Console.WriteLine(Math.Abs( -6.4 ));
Console.WriteLine(Math.Ceiling( -6.4 ));
Console.WriteLine(Math.Ceiling( -Math.Abs( -8 + Math.Floor( -5.5 ) ) ));
Console.WriteLine(Math.Ceiling( -6.4 ) * Math.Ceiling( -6.4 ));
Console.WriteLine(Math.Floor( 7.5 ) + Math.Floor( 7.5 ) / Math.Floor( 1.5 ));
Console.WriteLine(Math.Floor(7.5) / Math.Floor(7.5) + Math.Floor(1.5));
Console.ReadLine();
// 7.5
//7
//0
//0
//6.4
//-6
//-14
//36
//14
//2
}
}
}