C# Basics: Activity 6 - Methods

CSharp · Console

/Program.cs

using System;
					
public class Program
{
	public static void Main()
	{
		test(); // do not change or remove
	}
		
    // Instructions(Method):
    // Write the method pyramidCount
    // 1. fill the correct return type and parameter
    // 2. implement the method
        
    public static /*return type*/ pyramidCountx(/*parameter*/) {
    	// Add your code here
		
    }

	//This method tests that your code is correct
	public static void test() {
		if(pyramidCount(1) == 1 && 
			pyramidCount(2) == 5 && 
			pyramidCount(3) == 14 && 
			pyramidCount(4) == 30 && 
			pyramidCount(24) == 4900 && 
			pyramidCount(88) == 231044) 
		{
			  Console.WriteLine("Congradulations! Challenge Solved!");
		} 
		else 
		{
			  Console.WriteLine("Challenge failed!");
		}
	}
}
  
;