martes, 20 de octubre de 2009

Practica #7-1 (100 términos) .C

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


CONSOLA




double x = 1.0, T;
int d;
for (d = 2; d <= 198; d = d + 2) { T = 1.0 / d; Console.Write("{0}\n", T); x = x + T; } Console.Write("\n La suma de la serie es {0}", x); Console.ReadLine();


VISUAL



public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
double x = 1.0, T;
int d;
for (d = 2; d <= 198; d = d + 2) { T = 1.0 / d; listBox1.Items.Add(""+ T.ToString()); x = x + T; } listBox1.Items.Add("\n La suma de la serie es" + x.ToString()); } private void listBox1_SelectedIndexChanged(object sender, EventArgs e) { } } }


No hay comentarios:

Publicar un comentario