Jay Krishna Reddy
Print 1-100 Numbers without using loop in Console Application ?

Program to print 1-100 numbers in C# without using loops

By Jay Krishna Reddy in C# on Jul 14 2020
  • Ricardo Madiedo
    Jul, 2020 30

    1. public class Hundred
    2. {
    3. public static int printNumber(int number) {
    4. if (number == 101)
    5. return 0;
    6. Console.Write(string.Format("{0}{1}", number, number != 100 ? ", " : "."));
    7. return printNumber(number + 1);
    8. }
    9. }

    • 1
  • alok ranjan
    Jul, 2020 26

    use recursive function exit when number reached to 100

    • 1
  • Roshan Rathod
    Jul, 2020 22

    1. using System;
    2. class GFG{
    3. static public void Main ()
    4. {
    5. int i = 0;
    6. begin:
    7. i = i + 1;
    8. Console.Write(" " + i + " ");
    9. if (i < 100)
    10. {
    11. goto begin;
    12. }
    13. }
    14. }

    • 1

Most Popular Job Functions


MOST LIKED QUESTIONS