Answer to Question #14360 in C# for Bongani

Question #14360
How do you write a c# application program that ask three numbers and prints the average value?
NB. the program must have only two console.writeline statements.
1
Expert's answer
2012-09-07T11:00:23-0400
using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;




namespace Answer14360

{

class Program

{

static void Main(string[] args)

{

int _count=0;

int _average=0;

do

{

_count++;

Console.WriteLine("Enter {0}-st number ", _count);

_average += Convert.ToInt32(Console.ReadLine());

} while (_count < 3);



Console.WriteLine("Average value={0}",_average/3);

Console.ReadKey();

}

}

}

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

Assignment Expert
07.09.12, 18:57

You're welcome. We are glad to be helpful. If you really liked our service please press like-button beside answer field. Thank you!

Bongani
07.09.12, 18:55

wow it working thanks a lot

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS