Song Lee

Song Lee

  • NA
  • 47
  • 38.5k

Adding up numbers by 6

Sep 27 2014 6:23 PM
Hello C-Sharpcorner,
I want to know how to add numbers by 6, starting from #6 
(so, 6->12->18->24.. so forth until 100)

-----------------------------------------------------------------------------------------------

private void
six()
{
Console.WriteLine("the number will go up by 6");
double sixStart =6;

//Below is the nooby method that I came up with
//But I want to know if there is something better than doing this for individual numbers


Console.WriteLine("2nd # ={0}", sixStart + 6);
Console.WriteLine("3rd # ={0}", sixStart +12);

//Are there any formulas to replace this...?

}

Answers (3)