Why wont this loop correctly?
Code:
#define _CRT_SECURE_NO_WARNING
#include <stdio.h>
void main(void)
{
float ini,fin,inc,x;
printf("Enter initial value: ");
scanf("%f",&ini);
printf("Enter final value: ");
scanf("%f",&fin);
printf("Enter increment value: ");
scanf("%f",&inc);
while (ini<=fin)
{
printf("%5f\n",&ini);
ini=ini+inc;
}
printf("Look at what you have"); //ignore these lines, I made this just
scanf("%f",&ini); // keep the cmd from closing
}
I put in 30,100, and 10 respectively and all it does it give me eight rows of 0.000000 when it should give me:
30.000
40.000
50.000
60.000
70.000
80.000
90.000
100.000