Answer to Question #288122 in C# for Jonni

Question #288122

Trying to format response of dividing input of 100 sales/ 6 days to get sales needed per day. Want to format to 15 decimal places so answer would be 16.666666666666668 instead of 16. what is the best method?


1
Expert's answer
2022-01-17T12:58:42-0500
using System;
using System.Collections.Generic;


namespace App
{


    class Program
    {
        public static void Main()
        {


            Console.Write("Enter the number of sales: ");
            int sales = int.Parse(Console.ReadLine());


            Console.Write("Enter the number of days: ");
            int days= int.Parse(Console.ReadLine());


            double result = Math.Round((double)sales / (double)days, 15);


            Console.WriteLine("The result: "+ result.ToString());




            Console.ReadLine();
        }






    }
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS