© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
20 replies
⃟⃟⃟⃟⃟⃟⃟⃟⃟geno

✅ my code to calculate an average seems to be wrong

using System;
using System.Reflection.Metadata;

namespace startover 
{
    internal class Program
    {
        static void Main(string[] args)
        {
            //window setting
            Console.Title = "window name";
            Console.ForegroundColor = ConsoleColor.Green;
            Console.WindowHeight = 40;
            //main part of program
            int x;
            int y;
            int z;


            Console.Write("whats x? ");
            x = Convert.ToInt32( Console.ReadLine());

            Console.Write("whats y? ");
            y = Convert.ToInt32( Console.ReadLine());

            Console.Write("whats z? ");
            z = Convert.ToInt32( Console.ReadLine());

            int result = z+y+x/3;
            Console.WriteLine(result);


            
            Console.ReadKey();
        }
    }
}
using System;
using System.Reflection.Metadata;

namespace startover 
{
    internal class Program
    {
        static void Main(string[] args)
        {
            //window setting
            Console.Title = "window name";
            Console.ForegroundColor = ConsoleColor.Green;
            Console.WindowHeight = 40;
            //main part of program
            int x;
            int y;
            int z;


            Console.Write("whats x? ");
            x = Convert.ToInt32( Console.ReadLine());

            Console.Write("whats y? ");
            y = Convert.ToInt32( Console.ReadLine());

            Console.Write("whats z? ");
            z = Convert.ToInt32( Console.ReadLine());

            int result = z+y+x/3;
            Console.WriteLine(result);


            
            Console.ReadKey();
        }
    }
}

when i plug in 100 for the three values i get 233
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

❔ My Raycast seems to be upside down
C#CC# / help
4y ago
❔ Something wrong with my code
C#CC# / help
4y ago
✅ Why is my code still wrong?
C#CC# / help
3y ago
whats wrong with my code? [Answered]
C#CC# / help
4y ago