martes, 20 de octubre de 2009

PRACTICA 7.1

SEUDOCODIGO

InicioReal sumaserie = 1.0, termino
Int d
Print “+”,1
For d=2 to 198 step d=d+2
{termino+1.0/dprint termino “+”
sumaserie = sumaserie + termino}
print “=” , sumaserie final




CONSOLA










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 PRACTICA_7._1_WINDOWS
{
public partial class Form1 : Form
{
double SUMASERIE, TERMINO, VALOR;
int D;
public Form1()
{
TERMINO = D;
SUMASERIE = 1.0;
VALOR = 1;
InitializeComponent();
}
private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
{
}
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());
}
private void button2_Click(object sender, EventArgs e)
{
Close();
}
private void Form1_Load(object sender, EventArgs e)
{
}
}
}

No hay comentarios:

Publicar un comentario