Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 22 additions & 3 deletions week1/day2/assignments/mandatory/ChangeOddIndexToUpperCase.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package week1.day2.assignments.mandatory;

public class ChangeOddIndexToUpperCase {



/*
Pseudo Code
Expand All @@ -19,4 +18,24 @@ public class ChangeOddIndexToUpperCase {
* d)within the loop, change the character to uppercase, if the index is odd else don't change

*/
}
public static void main(String[] args) {
// TODO Auto-generated method stub

String original="changeme";
char[] chngeChar= original.toCharArray();
for(int i=0;i<chngeChar.length;i++) {
//System.out.print(chngeChar[i]);

if(i%2!=0) {
char ch=original.charAt(i);
System.out.println(Character.toUpperCase(ch));
}
else {
System.out.println(chngeChar[i]);
}

}

}

}