20091110

PRACTICA 6.1 SUMA DE NUMEROS IMPARES( visual)




using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
double N, I, S = 0.0;
N = double.Parse(textBox1.Text);
for (I = 1; I <= N; I = I + 2)
{
S = S + I;
}
textBox2.Text=(S.ToString());
textBox3.Text = N.ToString();
}
private void button2_Click(object sender, EventArgs e)
{
textBox1.Clear();
textBox2.Clear();
textBox3.Clear();
}
private void button3_Click(object sender, EventArgs e)
{
Close();
}

}
}

No hay comentarios:

Publicar un comentario