i write a code for "find the range of set of numbers" and when i am running, it is not giving output. i knows only "for, while, break, continue" so can't use recursion or anything else.

I am using DEVC++ .

what is wrong with this code ?

#include<stdio.h> #include<conio.h> main() { int i,j=1,max,min,tmp; printf("how many number are there to enter "); scanf ("%d",&i); /*code for take two number as max and min */ while (max>min || max == min) { printf("\n enter number \n"); scanf ("%d",&tmp); max = tmp; /* first number as max */ i=i-1; /*enter one number will reduce i by 1 */ printf ("enter number \n"); scanf ("%d",&tmp); if (tmp>max) max=tmp; else min=tmp; /* small number as min */ i=i-1; /* this will reduce i by 1 */ } /* now we have max and min number */ while (j<=i) { printf ("enter number"); scanf ("%d",&tmp); if (tmp>=max) max=tmp; /* when temp is >= max */ else if (tmp<=min) min=tmp; /* when temp is <= min */ j++; } printf ("the range of entered number is : ",max-min); getch(); }

output :