« first day (206 days earlier)      last day (449 days later) » 

10:48 AM
write this program .. Integer[] ints={1,2,3,4,5,6,7,8,9,10,11};

for(int i=0;i <ints.length;i++){

ints[i]=ints[i] % 100;
if(ints[i] > 11 || ints[i] < 13){

switch(ints[i]%10){

case 1: System.out.println(ints[i]+"st");
case 2: System.out.println(ints[i]+"nd");
case 3: System.out.println(ints[i]+"rd");
default:System.out.println(ints[i]+"th");
}
}

}
but it's showing 1st
1nd
1rd
1th
2nd
2rd
2th
3rd
3th
4th
5th
6th
7th
8th
9th
10th
11st
11nd
11rd
11th
 
2 messages moved from Java
 
why this > ints[i]=ints[i] % 100; ? shouldn't it be just 10 ?
 

« first day (206 days earlier)      last day (449 days later) »