Q) A program is required to input a series of at least three numbers from the keyboard. The first two numbers are to be lower and upper limit respectively. The program is require to output to the screen the total of all the following numbers which fall between those two limits, but are not equal to those limits. Use EOF to determine the end of the number sequence.

Ex: input 10, 20, 5, 12, 17, 23, 16,20

Output 45 (12+17+16)

Code:

#include<stdio.h>
#include<conio.h>
void main()
{
float x,y,z,sum=0;
clrscr();
printf("\n Enter atleast Three numbers:");
scanf("%f %f",&x,&y);
{if (0<y-x) {
scanf("%f",&z);
while (z==EOF){
if(x<z && y>z)
sum=sum+z;
scanf("%f",&z);}
}
else {
scanf("%f",&z);
while (z==EOF){
if(x>z && y<z)
sum=sum+z;
scanf("%f",&z);}
}
}
printf("\n Sum of values are :%f",sum);
getch();
}