how can i calculate the GCD and LCM of 5 numbers using a loop that i should create?? this is what i started doing but i think i started in wrong way from the beginning can anyone help
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner input=new Scanner(System.in);
int nbr1=input.nextInt();
int nbr2=input.nextInt();
int nbr3=input.nextInt();
int nbr4=input.nextInt();
int nbr5=input.nextInt();
for(int i=nbr1;(i%nbr2==0 || i%nbr3==0 ||i%nbr3||i%nbr4==0 || i%nbr5==0 ;i++)
{
}
}
}