using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplicationDemo
{
class PrintSeriesofNumberWithoutUsingLoop
{
public static void Main()
{
int no = 0, i = 1;
Console.WriteLine("Enter no.");
no = Convert.ToInt32(Console.ReadLine());
Num v = new Num();
v.print(i, no);
Console.ReadLine();
}
}
public class Num
{
public void print(int n,int nm)
{
if (n <= nm)
{
Console.WriteLine(n);
n++;
print(n, nm);
}
}
}
}
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplicationDemo
{
class PrintSeriesofNumberWithoutUsingLoop
{
public static void Main()
{
int no = 0, i = 1;
Console.WriteLine("Enter no.");
no = Convert.ToInt32(Console.ReadLine());
Num v = new Num();
v.print(i, no);
Console.ReadLine();
}
}
public class Num
{
public void print(int n,int nm)
{
if (n <= nm)
{
Console.WriteLine(n);
n++;
print(n, nm);
}
}
}
}
No comments:
Post a Comment