Page 433 - CA_Blue( J )_Class10
P. 433
17 if(ch=='A' || ch=='E' || ch=='I' || ch=='O' || ch=='U')
18 {
19 break;
20 }
21 }
22 pigwd = wd.substring(i) + wd.substring(0,i) + "AY";
23 System.out.println("Original Word : "+wd);
24 System.out.println("Piglatin Format: "+pigwd);
25 }
26 }
Note: To convert a word into a Piglatin word, we need to extract from the first vowel till the last to a
new word. Then add the remaining characters to the new word.At last add "AY".
To input a word and print in the following pattern.
Program 9 Input : INDIA
Output : INDIA
INDI
IND
IN
I
1 import java.util.*;
2 class pattern
3 {
4 public static void main()
5 {
6 Scanner sc= new Scanner(System.in);
7 String wd,extwd="";
8 int i, l;
9 char ch;
10 System.out.print("Enter a word: ");
11 wd=sc.next();
12 wd=wd.toUpperCase();
13 l=wd.length();
14 for(i=0;i<l;i++)
15 {
16 extwd=wd.substring(0,l-i);
431
String Handling 431

