I am trying to print the incremented values up to the given number by (0.1). I am getting two inputs x and y and then I am trying to print the values from x to y incremented by 0.1, but i am facing the problem. Below is my code. Thanks in advance.
#include<stdio.h>
int main()
{
float x,y,i;
scanf("%f %f\n",&x,&y);
for(i=x;i<=y;)
{
printf("%.1f ",i);
i=i+0.1;
}
Input: 9.4 10.2
Output:
9.4 9.5 9.6 9.7 9.8 9.9 10.0 10.1
Expected Output:
9.4 9.5 9.6 9.7 9.8 9.9 10.0 10.1 10.2