Iterating through Array using modulus operator c -
I would like the user to keep the current average of a fixed number. I'm using the modulus operator to wrap around the array using new and old ones. I want to do this with a modulus operator. But every time I enter 10 for N, I may not have to enter a value in the first index. {Int} [int] [int] [m] = {'\ 0'}, n, new = 0, old = 0, i, value = 0; Float total, average; Printf ("Enter the number of values that are greater than the average (n):"); Scanf ("% d", & amp; n); By emphasis (N> 0 & amp; amp; amp; amp; amp; amp; amp; n & lt; = 10); While (1) {printf ("Enter a value:"); Scanf ("% d", and data [new]); Printf ("buffer content:"); For (i = 0; i
total + = data [value]; Value ++; Total is never initialized, so it can be undefined behavior using unrecognized variables.
Comments
Post a Comment