C Program to Find the Largest Number in an Array

WBahn

Joined Mar 31, 2012
32,875
I Made a Mistake. I Sincerely apologise for my mistakes. I feel very bad to know that I am wasting your time. I am really sorry for repeating same mistake. I have been told you english is not my native language so that's why I struggle at some point

Please look at once again my work.
Now THAT'S progress! Good job.

Where you say, "Print the element of the array" in the first loop, that is confusing because it implies you are going to print the value of an array element before getting it from the user. A better label might be "Prompt user for array element".

You should get in the habit of using "int main(void)" as your main() declaration. Leaving out the 'void' is an old form and is strongly deprecated by the C standard.

Your code listing is still inconsistent in its indenting. Using proper and clean indenting is extremely important for conveying code structure to humans (the compiler doesn't care).

The next step might be to check the value that the user enters for the number of elements against the legal values (at least 1 but no more than 10, in this case) and if the number is not legal, print an error message and ask again. Do this in a loop until they enter a legal value.
 

Thread Starter

Parth786

Joined Jun 19, 2017
642
Now THAT'S progress! Good job.
I feel like I have survived but death can come at any time

Your code listing is still inconsistent in its indenting. Using proper and clean indenting is extremely important for conveying code structure to humans (the compiler doesn't care).
I have fully tried to write proper code. if do you think there is need to improvement please let me know

.The next step might be to check the value that the user enters for the number of elements against the legal values (at least 1 but no more than 10, in this case) and if the number is not legal, print an error message and ask again. Do this in a loop until they enter a legal value.
Does my code match with flow chart?

Result:
Prompt user for array size: 11

Error
Prompt user for array size: 12

Error
Prompt user for array size: 13

Error
Prompt user for array size: 4
Prompt user for array element: 5
Prompt user for array element: 65
Prompt user for array element: 188
Prompt user for array element: 6
smallest number in array 5
largest number in array 188

Note : my software allow me limited object. I don't have permission to use maximum object so that's why some part of my part flow chart is incomplete. so I have edited that flow chart in paint. I am posting both poor and good quality of flow chart
 

Attachments

Last edited:
Top