C# program toward print 1 2 4 8 16 21 64 128 …nth iteration
Program Statement:
Write a program using beneficial to loop which prints the following series.
1 2 4 8 16 21 64 128 …nth iteration
Solution:
static void Main(string[] args)
{
int n,i=1,num=1;
Console.WriteLine("Enter Value regarding n ");
n = Convert.ToInt32(Console.ReadLine());
Console.Write(i+" ");
beneficial to (i = 1; i <= n; i++)
{
num = num * 2;
Console.Write(num + " ");
}
Console.ReadLine();
}