Answer to Question #8746 in Action Script | Flash | Flex | ColdFusion for jamar

Question #8746
how to write a C# consloe program that asks for three numbers and prints the average value?
1
Expert's answer
2012-04-26T07:26:27-0400
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace tempCs
{
class Program
{
static void Main(string[] args)
{
int avg=0;
for (int i = 0; i < 3; i++)
{
Console.Write("Enter number " + (i+1) + ": ");
avg += int.Parse(Console.ReadLine());
}
avg /= 3;
Console.WriteLine("Average = " + avg);
}
}
}

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