The question reads:

Quote

Write a program to compute the power loss in a transmission line with a

resistance of 0.05 ohms/mile. Compute the power loss if 500 kW of power is

transmitted from a power generating station to cities at distances of 20, 30,

50, 50, ..., 100 miles at 100V and 200V.

power transmitted in watts

i = ------------------------------

volts transmitted

The total resistance R is computed from the equation:

R = r x miles

where r is the resistance per mile.

The power loss is computed from the equation:

Power loss = i^2 x R.

resistance of 0.05 ohms/mile. Compute the power loss if 500 kW of power is

transmitted from a power generating station to cities at distances of 20, 30,

50, 50, ..., 100 miles at 100V and 200V.

power transmitted in watts

i = ------------------------------

volts transmitted

The total resistance R is computed from the equation:

R = r x miles

where r is the resistance per mile.

The power loss is computed from the equation:

Power loss = i^2 x R.

Here is my code:

#include <stdio.h> #include <iostream> int main(void) { int v=1; int dist=1; int i = (500 / 100); float r = 0.05; int val = 20; float R = 0.05 * val; float pwr_loss = (val * r) * (i * i); printf("\t Voltage \t Distance \t Power Loss\n"); printf("\t=============================================\n"); for (dist=1; dist<=9; dist++) { printf("\t %7d \t %8d \t %8d\n", v*100, val, pwr_loss); val = 10 + val; pwr_loss = (0.05 * val)*(i*i); } printf("\n\n"); system("PAUSE"); return 0; }I don't want exact answers necessarily, I'm trying to figure out why I can't get the code to run. I keep getting zero's for the power loss.

Any nudges in the right direction are appreciated.