Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

C# Programming Problem and Solution – Average


Problem: Write a program that accepts three numbers and outputs their average.

Solution:


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Problem10{
 class Program{
  static void Main(string[] args){
   int num1 = 0;
   int num2 = 0;
   int num3 = 0;
   int ave = 0;

   Console.Write("Enter value of num1: ");
   num1 = Int32.Parse(Console.ReadLine());
   Console.Write("Enter value of num2: ");
   num2 = Int32.Parse(Console.ReadLine());
   Console.Write("Enter value of num3: ");
   num3 = Int32.Parse(Console.ReadLine());
   ave = (num1 + num2 + num3) / 3;

   Console.WriteLine("Average is " + ave.ToString());
   Console.ReadKey();
  }
 }
}

Video:

The code is posted here: http://more-codes.com/problems.php

Github Link: problem10.cs

Github Repository: Easy Problems

For more C# Programing Problems and Solutions, please visit us at more-codes.com

Facebook: Like Us!
Twitter: Follow Us!
Thank you very much.


The post C# Programming Problem and Solution – Average appeared first on MoreCodes.

Share the post

C# Programming Problem and Solution – Average

×

Subscribe to Morecodes | Learn Programming Problems And Solutions In C,c++, Java, D, Vb.net, C#, F#, Ruby, Python

Get updates delivered right to your inbox!

Thank you for your subscription

×