lunes, 26 de octubre de 2009

Practica 7.1 Visual



PSEUDOCODIGO

double x = 1.0, T;

int d;

for (d = 2; d <= 198; d = d + 2)

{

T = 1.0 / d;

Print(T);

x = x + T;

}

Print( La suma de la serie es: {0}", x);

Final








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 WindowsFormsApplication4
{
public partial class Form1 : Form
{
double sumaserie, termino, valor;
int d;
public Form1()
{
termino = d;
sumaserie = 1.0;
valor = 1;
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
listBox1.Items.Add("+" + valor.ToString());
for (d = 2; d <= 198; d = d + 2)
{
termino = 1.0 / d;
listBox1.Items.Add("+" + termino.ToString());
sumaserie = sumaserie + termino;
}
listBox1.Items.Add("=" + sumaserie.ToString());
}
}
}

No hay comentarios:

Publicar un comentario