© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•2mo ago•
14 replies
Hwop

Not big issue just curious about warning in C#

beginner
Hello recently today i was asking about a project inside of c# and i had some amazing people inside of this discord help me with creating this project. The project is simple its to simply draw a triangle to the screen using only the terminal window i stuggled with this for a week now (im a slow learner) but today i got it running

Something i dont understand and am not sure if i need to is i get a warning now that i created user input inside of the code

WARNING convert null literal

not sure what exactly that means i am taking a user input and converting it over into an int but i dont know how to prevent this or even if i should be worrying about this

Any input or help is well Appriciated and i love hearing from this community!!! ❤️

//take user input and make it into a isosceles triangle
using System;
namespace Course
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Enter how tall you would like you triangle to be (Number Ex. 1,2,3,4...)");
            string userInput_string = Console.ReadLine();
            int userInput_int = Convert.ToInt32(userInput_string);
            for(int row = 0; row < userInput_int; row++)
            {
                for(int space = userInput_int; space > row; space--)
                {
                    Console.Write(" ");    
                }
                for (int symbol = 0; symbol <= row; symbol++)
                {
                    int remainder = symbol % 2;
                    if(symbol == 0)
                    {
                        Console.Write("#");
                    }
                    else if(remainder == 1 || remainder == 0)
                    {
                        Console.Write("##");
                    }
                    else
                    {
                        Console.WriteLine("ERROR");
                    }
                }
                Console.WriteLine();
            }
        }
        
    }
}
//take user input and make it into a isosceles triangle
using System;
namespace Course
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Enter how tall you would like you triangle to be (Number Ex. 1,2,3,4...)");
            string userInput_string = Console.ReadLine();
            int userInput_int = Convert.ToInt32(userInput_string);
            for(int row = 0; row < userInput_int; row++)
            {
                for(int space = userInput_int; space > row; space--)
                {
                    Console.Write(" ");    
                }
                for (int symbol = 0; symbol <= row; symbol++)
                {
                    int remainder = symbol % 2;
                    if(symbol == 0)
                    {
                        Console.Write("#");
                    }
                    else if(remainder == 1 || remainder == 0)
                    {
                        Console.Write("##");
                    }
                    else
                    {
                        Console.WriteLine("ERROR");
                    }
                }
                Console.WriteLine();
            }
        }
        
    }
}
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

✅ Just curious about something
C#CC# / help
2y ago
❔ Learning C#, and curious about advanced return statements...
C#CC# / help
3y ago
❔ Big Problem in C# plz someone help
C#CC# / help
3y ago
❔ Little question about c# in UNITY
C#CC# / help
3y ago