C#

Looping Statement : for Statement

Looping Statement : for Statement
using System;



public class exam

 {

    public static void Main()

    {

       int f,f1,f2,i,n;



       f1=-1;

       f2=1;

     

       Console.Write("Enter the Number : ");

       n = int.Parse(Console.ReadLine());



          for(i=0;i<n;i++)

            {

               f = f1+f2;

               Console.WriteLine("\n"+f);

               f1 = f2;

               f2 = f;

             }

       }

  }
Senthilvelan Sambamoorthy

Senthilvelan Sambamoorthy is working as a Professor in Department of Master of Computer Applications, Paavai Engineering College, Namakkal, Tamilnadu, India, He is Masters in Computers Applications. Having 18+ years of experience and his area of interest is Java, JSP, Servlet, J2EE, C#, PHP, Python ASP.NET, SQL Server and etc.