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
  • shahraiz kayani
    Sep, 2020 14

    1. List<int> list = Enumerable.Range(number, 100).ToList();
    2. string s = string.Join(", ",list.Select(x =>x.ToString()));
    3. Console.WriteLine(s);

    • 5
  • 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. }

    • 2
  • alok ranjan
    Jul, 2020 26

    use recursive function exit when number reached to 100

    • 2
  • 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