I am not sure which part of the code is creating an infinite loop when there are no -1s
package com.codegym.task.task04.task0442;
/*
Adding
*/
import java.io.*;
import java.util.*;
public class Solution {
public static void main(String[] args) throws Exception {
//write your code here
Scanner sc = new Scanner(System.in);
int a = Integer.parseInt(sc.nextLine());
int b = Integer.parseInt(sc.nextLine());
int c = Integer.parseInt(sc.nextLine());
int d = Integer.parseInt(sc.nextLine());
int e = Integer.parseInt(sc.nextLine());
while (true){
if (a == -1 || b == -1 || c == -1 || d == -1 || e == -1){
break;
}//System.out.println(a + b + c + d + e);
}System.out.println(a + b + c + d + e);
}
}