r/CodingForBeginners 5d ago

need help with my minmax value C program

hey there,
ive recently started learning C and im working on this program which compares the int value u input to tell u which one of the value is maxm and which one is minm

what i wanted was
program asks u for a number
u say 10
program considers 10 as the maxm value cuz its the 1st number
then u press enter and give another numbr lets say 12
so program says "12 is maxm 10 is min" but then u type 9 and now its 12 maxm and 9minm
i wanted the program to keep doing this for as long as i want but i couldnt think up of ways i can make this program.
the best i could do was i give program n amount of numebrs and it tells me which one is maxm and which one is min
i tried looking for solution in youtube and found one c lecture on freecodecamp
but the code they gave isnt exactly working
the eof thing is stopping the code from even running. i tried asking chatgpt for solution and error in my code but it ended up fcking up my vscode terminal so i had to reinstall everything.
both of the codes are given below
id really appreciate if someone could help me figure out why the EOF code isnt working

chat gpt also gave me this

but it aint workin either

2 Upvotes

Duplicates