class Ideone{publicstaticvoid main(String[] args){for(int i=1;i<=12;i++){System.out.print("On the ");switch(i){case1:System.out.print("first");break;case2:System.out.print("second");break;case3:System.out.print("third");break;case4:System.out.print("fourth");break;case5:System.out.print("fifth");break;case6:System.out.print("sixth");break;case7:System.out.print("seventh");break;case8:System.out.print("eighth");break;case9:System.out.print("ninth");break;case10:System.out.print("tenth");break;case11:System.out.print("eleventh");break;case12:System.out.print("twelfth");break;}System.out.println(" day of Christmas\nmy true love gave to me");switch(i){case12:System.out.println("Twelve drummers drumming");case11:System.out.println("Eleven pipers piping");case10:System.out.println("Ten lords-a-leaping");case9:System.out.println("Nine ladies dancing");case8:System.out.println("Eight maids-a-milking");case7:System.out.println("Seven swans-a-swimming");case6:System.out.println("Six geese-a-laying");case5:System.out.println("Five golden rings");case4:System.out.println("Four calling birds");case3:System.out.println("Three french hens");default:if(i>=2)System.out.print("Two turtle doves\nAnd a");elseSystem.out.print("A");System.out.println(" partridge in a pear tree");break;}System.out.println();}}}
On the first day of Christmas
my true love gave to me
A partridge in a pear tree
On the second day of Christmas
my true love gave to me
Two turtle doves
And a partridge in a pear tree
On the third day of Christmas
my true love gave to me
Three french hens
Two turtle doves
And a partridge in a pear tree
On the fourth day of Christmas
my true love gave to me
Four calling birds
Three french hens
Two turtle doves
And a partridge in a pear tree
On the fifth day of Christmas
my true love gave to me
Five golden rings
Four calling birds
Three french hens
Two turtle doves
And a partridge in a pear tree
On the sixth day of Christmas
my true love gave to me
Six geese-a-laying
Five golden rings
Four calling birds
Three french hens
Two turtle doves
And a partridge in a pear tree
On the seventh day of Christmas
my true love gave to me
Seven swans-a-swimming
Six geese-a-laying
Five golden rings
Four calling birds
Three french hens
Two turtle doves
And a partridge in a pear tree
On the eighth day of Christmas
my true love gave to me
Eight maids-a-milking
Seven swans-a-swimming
Six geese-a-laying
Five golden rings
Four calling birds
Three french hens
Two turtle doves
And a partridge in a pear tree
On the ninth day of Christmas
my true love gave to me
Nine ladies dancing
Eight maids-a-milking
Seven swans-a-swimming
Six geese-a-laying
Five golden rings
Four calling birds
Three french hens
Two turtle doves
And a partridge in a pear tree
On the tenth day of Christmas
my true love gave to me
Ten lords-a-leaping
Nine ladies dancing
Eight maids-a-milking
Seven swans-a-swimming
Six geese-a-laying
Five golden rings
Four calling birds
Three french hens
Two turtle doves
And a partridge in a pear tree
On the eleventh day of Christmas
my true love gave to me
Eleven pipers piping
Ten lords-a-leaping
Nine ladies dancing
Eight maids-a-milking
Seven swans-a-swimming
Six geese-a-laying
Five golden rings
Four calling birds
Three french hens
Two turtle doves
And a partridge in a pear tree
On the twelfth day of Christmas
my true love gave to me
Twelve drummers drumming
Eleven pipers piping
Ten lords-a-leaping
Nine ladies dancing
Eight maids-a-milking
Seven swans-a-swimming
Six geese-a-laying
Five golden rings
Four calling birds
Three french hens
Two turtle doves
And a partridge in a pear tree