febinocci.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="febinocci.aspx.cs" Inherits="our_program.febinocci" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>check febinocci or not</title>
<center><h1>check febinocci or not</h1></center>
</head>
<body>
<form id="form1" runat="server">
<center>
<div>
<asp:TextBox ID="txt" runat="server"></asp:TextBox>
<br />
<br />
<asp:Button ID="btn" runat="server" Text="Button" onclick="btn_Click" />
<br />
<br />
<asp:Label ID="lbl" runat="server" Text=""></asp:Label>
</div>
</center>
</form>
</body>
</html>
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="febinocci.aspx.cs" Inherits="our_program.febinocci" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>check febinocci or not</title>
<center><h1>check febinocci or not</h1></center>
</head>
<body>
<form id="form1" runat="server">
<center>
<div>
<asp:TextBox ID="txt" runat="server"></asp:TextBox>
<br />
<br />
<asp:Button ID="btn" runat="server" Text="Button" onclick="btn_Click" />
<br />
<br />
<asp:Label ID="lbl" runat="server" Text=""></asp:Label>
</div>
</center>
</form>
</body>
</html>
febinocci.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace our_program
{
public partial class febinocci : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btn_Click(object sender, EventArgs e)
{
int n = Convert.ToInt16(txt.Text);
int a = 0, s = 1, d = 1;
int j = n * 2;
string output = "";
for (int i = 0; i < j; i++)
{
a = s; s = d;
d = a + s;
j = j * 2;
if (n == d)
{
break;
}
}
if (n == d)
{
output = "The numbers " + n + " is Fibonacci";
}
else
{
output = "The numbers " + n + " is not Fibonacci";
}
lbl.Text = output;
}
}
}
No comments:
Post a Comment