public partial class Form1 : Form
{
int x;
public Form1()
{
InitializeComponent();
}
private void button1_Click_2(object sender, EventArgs e)
{
x = Convert.ToInt16(textBox1.Text);
if (x % 2 == 0) { label4.Text = "number is Even"; }
else if (x % 3 == 0) { label4.Text = "number is odd"; }
else if (x % x == 0) { label4.Text = "number is Prime"; }
else
{
label4.Text = "number is invalid";
}
}
}
run
output
!--------------------------------------------------------------------------------------------------------------------!
Fabbocani Series Program in C#
Code!!
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace fabbocani_series
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
first = 0; second = 1;
if (e.KeyCode == Keys.Enter)
{
n = Convert.ToInt32(textBox1.Text);
for (c = 0; c < n; c++)
{
if (c <= 1)
{
next = c;
}
else
{
next = first + second;
first = second;
second = next;
}
richTextBox1.Text = " , " + next + richTextBox1.Text;
}
richTextBox1.Text = "\nfirst " + n + "number is at fabbocanic series is:-" + richTextBox1.Text;
}
}
}
{
int x;
public Form1()
{
InitializeComponent();
}
private void button1_Click_2(object sender, EventArgs e)
{
x = Convert.ToInt16(textBox1.Text);
if (x % 2 == 0) { label4.Text = "number is Even"; }
else if (x % 3 == 0) { label4.Text = "number is odd"; }
else if (x % x == 0) { label4.Text = "number is Prime"; }
else
{
label4.Text = "number is invalid";
}
}
}
run
output
!--------------------------------------------------------------------------------------------------------------------!
Fabbocani Series Program in C#
Code!!
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace fabbocani_series
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
first = 0; second = 1;
if (e.KeyCode == Keys.Enter)
{
n = Convert.ToInt32(textBox1.Text);
for (c = 0; c < n; c++)
{
if (c <= 1)
{
next = c;
}
else
{
next = first + second;
first = second;
second = next;
}
richTextBox1.Text = " , " + next + richTextBox1.Text;
}
richTextBox1.Text = "\nfirst " + n + "number is at fabbocanic series is:-" + richTextBox1.Text;
}
}
}
No comments:
Post a Comment