- Joined
- Mar 13, 2019
- Messages
- 2
- Reaction score
- 0
C:
#include<stdio.h>
int main( void )
{
int sum = 0;
float average;
int weight_1, weight_2;
printf( "1.weight> " );
scanf( "%d", &weight_1 );
sum = sum + weight_1;
printf( "2.weight> " );
scanf( "%d", &weight_2 );
sum = sum + weight_2;
average = sum / 2.0;
printf( "Average: %f\n", &average );
return 0;
}
When i run, code gives the average as 0.00000000. What's the problem?
Last edited by a moderator: