im not god in programing im stil new to it need help please
find the MAX and MIN number then calculate and display the average [(MAX+MIN)/2]
#include<stdio.h>
int main(void)
int NumArray[] = {2 ,67 ,23 ,5 ,7 ,34 ,14 ,4 ,8 , 62};
int max, min, i;
double b;
max=numArray[i]
min=numArray[i]
for(i=1; i<10;i++)
if(max<numArray[i])
max=numArray[i];
for(i=1; i<10; i++)
if(min>numArray[i])
min=numArray[i];
b=(max+min)/2;
prinf("the average of the maximun and minimum number is %lf", b);
}
juljan30
0
Newbie Poster
Recommended Answers
Jump to PostArray index in C starts with "0" not "1".So always initialize your array index variable "i" with 0
All 2 Replies
Reply to this topic
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.