Generate Fibonacci Series

1:  public partial class JDfibonacci : System.Web.UI.Page  
2:  {  
3:    protected void Page_Load(object sender, EventArgs e)  
4:    {  
5:      int f1 = 0, f2 = 1, f3 ;  
6:      Response.Write(f1);  
7:      Response.Write(f2);  
8:        
9:      for (int i =2; i <10; i++)  
10:      {  
11:        f3 = f1 + f2;  
12:        f1 = f2;  
13:        f2 = f3;  
14:        Response.Write(f3);  
15:      }   
16:    }  
17:  }  

No comments:

Post a Comment