TOPIC

why wrong answer 100%

Luis Maldonado asked 1 year ago

Scanner gordis=new Scanner(System.in); int c,j,N,suma=0; float prom,por,cont=0; c=gordis.nextInt();

    while(c>0)
    {
        suma=0;
        cont=0;
        N=gordis.nextInt();
        int [] cal= new int [N];

        for(j=0; j<N; j++)
        {
            cal[j]=gordis.nextInt();
            suma+=cal[j];
        }
        suma/=N;

        for(j=0; j<N; j++)
        {
            if (cal[j]>suma) cont++;
        }

        System.out.printf("%.3f%%\n",cont/N*100.000);

        c--;
    }

This topic has not been answered yet. Be the first!

Remember not post solutions. Your post may be reviewed by our moderators.