Hello,
I have the following code that works great:
How could I get it to run through the loop for a second time withCode:#include <stdio.h> 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 %8f\n", v*100, val, pwr_loss); val = 10 + val; pwr_loss = (0.05 * val)*(i*i); } printf("\n\n"); system("PAUSE"); return 0; }changing toCode:int i = (500 / 100);?Code:int i = (500 / 200);
The output would give you the voltage, distance, and power loss with a voltage of 100 counting to 100 mile distance. It would then output the voltage, distance, and power loss with a voltage of 200 counting to 100 mile distance.
Any help would be greatly appreciated!
Thanks,
John



LinkBack URL
About LinkBacks



