Specific condition not working in my do-while loop?

int dbgEnter(int measurements[], int *nr) { int i = 0; do { printf("Enter Measurement #%d: ", i+1); scanf("%d", &measurements[i]); i++; int *nr = &i; } while (i < MAX && measurements[i] != 0); For some reason measurements[i] != 0 doesn’t seem to register as a condition for the while-loop. I tried it inside do with… Read More Specific condition not working in my do-while loop?

Why is my do-while loop not producing the same results as my for & while loops?

I’m trying to write the same loop to calculate the sum of the integers from 1 to the input value, and output the sum 3 different ways, and so far I’ve completed my for and while loops correctly, and had them output the same result. However, for some reason my do-while loop isn’t working properly,… Read More Why is my do-while loop not producing the same results as my for & while loops?

C++: For two different functions with do-while loops, why does x+=y give the same result as x=x+y in one function but not the other?

For function A below, I get a different result when I use "est += XXX" as compared to using "est = est + XXX". The former gives a result of 1.33227e-15 while the latter gives an result of 8.88178e-16. On the other hand, for function B below, I get the same result regardless of whether… Read More C++: For two different functions with do-while loops, why does x+=y give the same result as x=x+y in one function but not the other?

How do I add a do-while loop in this program so that if the input is less than 4 it doesn't print anything

#include <stdio.h> int main () { int row, i, j; printf("Enter a number: "); scanf("%d", &row); for (i=1; i<=row; i++) { for (j=1; j<=row; j++) { if (i==1 || i==row || i+j==row+1) { printf("*"); } else { printf(" "); } } printf("\n"); } printf("\n\n"); } return 0; } The program prints out the letter "Z"… Read More How do I add a do-while loop in this program so that if the input is less than 4 it doesn't print anything

Using a do while loop correctly?

My conditions are as follows : If the value of userIncome is entered more than 400000, show error. Similarly, if the value is less than 500, show error. Repeat the loop until a correct value is entered. #define _CRT_SECURE_NO_WARNINGS #define minINCOME 500.00 #define maxINCOME 400000.00 #include <stdio.h> int main(void) { float userIncome ; printf("+————————–+\n" "+… Read More Using a do while loop correctly?