I have this code and I want to print all the numbers of an arithmetic progression of ratio 0.3 but when I use the following code it includes 3, when I wanted all non-negative below 3. What would be another way to do it?
#include <stdio.h>
int main() {
double x = 0;
while(x < 3.0) {
printf("x = %f\n", x);
x += 0.3;
}
return 0;
}