Skip to content

Commit e6bae9e

Browse files
committed
Average between two numbers of an array
1 parent 5c1a7fa commit e6bae9e

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

avg.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public static void main(String[] args) {
3636
System.out.println("Index not found");
3737
}
3838
int sum=0, count=0;
39-
if(upperIndex>0)
39+
if(upperIndex>0 && lowerIndex+1<upperIndex)
4040
{
4141
for(int i=lowerIndex+1; i<upperIndex; i++)
4242
{

0 commit comments

Comments
 (0)