This should work:
for (int i=1; i<=4; i++) {
for (float j=i; j<=std::max(1.6, i); j+=0.5) {
cout << j << endl;
}
}
The above code will print the desired sequence.
6
solved int and float increment condition in for loop [closed]
This should work:
for (int i=1; i<=4; i++) {
for (float j=i; j<=std::max(1.6, i); j+=0.5) {
cout << j << endl;
}
}
The above code will print the desired sequence.
6
solved int and float increment condition in for loop [closed]