Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Blog
Print 1 to 100 without using loop
//Rextester.Program.Main is the entry point for your code. Don't change it. //Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5 //How will you print numbers from 1 to 100 without using loop? //Solution that prints numbers using recursion. using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; //DEVELOPER: PANNA CHATTERJEE namespace Rextester { public class Program { public static void Main(string[] args) { PrintNumbers(100); } // Prints numbers from 1 to n static void PrintNumbers(int n) { if(n > 0) { PrintNumbers(n - 1); Console.Write(n + " "); } return; } } }
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
hello
Factorial using Recursion
Pyramid using C#
UrlDecode
2.2 Basic types: Dictionary
bbbbbb
Classes, properties, methods, ling begining
triangular matrix
ParseIpRanges invalid character in string
Homework3
stackse - search stackoverflow differently
Please log in to post a comment.