Hello good afternoon, I am new to this and for a university project I found myself in need of a bit of basic programming. I'll paste the script and then relatare what I need.
import java.util.Scanner;
public class ModosNormales {
public static void main(String[] ar) {
Scanner teclado=new Scanner(System.in);
int nx,ny,c,n;
float lx;
float ly;
float fn;
c=172;
System.out.print("Ingrese valor de nx:");
nx=teclado.nextInt();
System.out.print("Ingrese valor de ny:");
ny=teclado.nextInt();
System.out.print("Ingrese lx:");
lx=teclado.nextFloat();
System.out.print("Ingrese ly:");
ly=teclado.nextFloat();
fn=c*(float) Math.sqrt(Math.pow((nx/lx),2)+(float)(Math.pow((ny/ly),2)));
System.out.print("Fn=");
System.out.println(fn);
for(n=1;n>0;n++) {
int nx1,ny1;
float fn1;
System.out.print("Ingrese valor de nx:");
nx1=teclado.nextInt();
System.out.print("Ingrese valor de ny:");
ny1=teclado.nextInt();
fn1=c*(float) Math.sqrt(Math.pow((nx1/lx),2)+(float)(Math.pow((ny1/ly),2)));
System.out.print("Fn=");
System.out.println(fn1);
if(fn1>=500)
{System.out.println("Frecuencia mayor o igual a 500Hz"); break;
}}}}
I need to know how many "fn1" are repeated since each "fn1" is different result because here ..
fn1 = c * (float) Math.sqrt (Math.pow ((nx1 / lx), 2) + (float) (Math.pow ((ny1 / ly), 2))); They vary the Nx1 ... lx ... etc
Then I get different "fn1" so how can I do that to save it and tell me how many fn1 are repeated? I do not know if he explains me well since I am a novice in this. I would appreciate it