# Answer to Question #34777 in C++ for Tawanna

Question #34777

I keep getting an error in my program:

#include< stdio.h >

void main()

{

double r=0.05;

int distance;

double R,i;

double power=500;

int v1=100,v2=200;

//calculating powerloss at v1=100

printf("\nPower loss at 100v");

for(distance=20;distance < =100;distance=distance+10)

{

R=distance*r;

i=power/v1;

double powerloss=(i*i)*R;

printf(" \nPower loss at %d distance is%f",distance,powerloss);

}

printf("\nPower loss at 200v");

for(distance=20;distance< =100;distance=distance+10)

{

R=distance*r;

i=power/v1;

double powerloss=(i*i)*R;

printf(" \nPower loss at %d distance is%f",distance,powerloss);

}

}

#include< stdio.h >

void main()

{

double r=0.05;

int distance;

double R,i;

double power=500;

int v1=100,v2=200;

//calculating powerloss at v1=100

printf("\nPower loss at 100v");

for(distance=20;distance < =100;distance=distance+10)

{

R=distance*r;

i=power/v1;

double powerloss=(i*i)*R;

printf(" \nPower loss at %d distance is%f",distance,powerloss);

}

printf("\nPower loss at 200v");

for(distance=20;distance< =100;distance=distance+10)

{

R=distance*r;

i=power/v1;

double powerloss=(i*i)*R;

printf(" \nPower loss at %d distance is%f",distance,powerloss);

}

}

Expert's answer

## Comments

## Leave a comment