Why giving wrong answer ? Max and min problem

The program seems to be correct but gives wrong answer-

The link to solution is- maxandmin

Do not print any messages like “Give N” .You should only print the output of the program.

Please provide the link of the question if you still face any difficulty.

Happy Coding!!!

As @the65bit says, it is like Sgt. Joe Friday says in Dragnet … “Only the facts, Ma’am.”

The Online Judge compares your output to the “correct answer output” and if there is any non-whitespace difference, then it is wrong.

Any debug or testing output must be removed prior to the Submit.

Please provide link to question.

1 Like

I have written the question in above comment. After removing , “Give N” again it produces any garbage value.

I am not testing it on any online judge. I am testing it on my own computers
and answer produced are not even given as input ie any garbage value is returned as output. You may try it on your compiler.

Please help!!

Please provide link to question where you are trying to submit the solution.

Come on, how should we know why your program is incorrect when you are not able to share what is your goal? I took a quick look at you link, but it is not clear to me what are you doing. Please read this and edit your question properly.

I am studying from nptel.ac.in . It is website maintained by govt of India and contains courses from IIT’s. I am on course of Programming and Data Structures. In the course it is being explained how to reduce time by making program efficient. The goal of this lecture is to find out the maximum and minimum of given N numbers. That is on first line a number N will be taken as input and than N lines containing integers. Out of those N numbers you have to find the maximum and minimum among them. The code is giving wrong answer on my computer but giving correct output on the proffesor’s computer.

The link to lecture is- nptel.ac.in/courses/106105085/6

You can have a look at it if you want.

Help will be really appericiated.

I am studying from nptel.ac.in . It is website maintained by govt of India and contains courses from IIT’s. I am on course of Programming and Data Structures. In the course it is being explained how to reduce time by making program efficient. The goal of this lecture is to find out the maximum and minimum of given N numbers. That is on first line a number N will be taken as input and than N lines containing integers. Out of those N numbers you have to find the maximum and minimum among them. The code is giving wrong answer on my computer but giving correct output on the proffesor’s computer.

The link to lecture is- nptel.ac.in/courses/106105085/6
The output produced on my computer is any garbage value.
You can have a look at it if you want.

Help will be really appericiated.