vendredi 2 décembre 2016

The java code isn't working as it's expected to

for(i=0;i<binary.length;i++)
    {
        temp=sc.nextInt();
        if(temp==5)
        {
            break;
        }
        else if(temp==0||temp==1)
        {
            binary[i]=temp;
            count++;
        }

    }
    for(i=0;i<count;i++)
    {
        System.out.println("Entered binary number is"+binary[i]);
    }//This appends a 0 at an array i enter. please help me out..

if i enter an array 1111 it displays 11110 and I can't understand why. Where is the problem..?

Aucun commentaire:

Enregistrer un commentaire