6.01- return false;
6.02 - string r = "";
for(int i = 0; i < s.Length ;i++){
if (i % 2 == 0){
r += s.Substring(i, 1).ToUpper();
}
else
r += s.Substring(i, 1);
}
return r;
6.03 - string r = "";
for(int i = 0, j = 1; i < s.Length; i++, j++){
if(i == s.Length - 1 || s[j] == ' ' ){
r += Char. ToUpper(s[i]);
}
else{
r += s[i];
}
}
return r;
6.04 - return s[x];
6.05 - return two + one;
6.06 - return s.Substring(s.Length/2);
6.07 - string r = "";
r = s.Substring((s.Length/2)+1).ToUpper();
r += s.Substring((s.Length /2));
return r;
6.08 - if(b.Length > a.Length){
return b.Length;
}
return a.Length;
6.09 - if(a.Length > b.Length){
return a;
}
if(b.Length > a.Length){
return b;
}
return a + b;
6.10 - return s.Length /3;
6.11- return s.Substring(i, s.Length - 1 - i) + s.Substring(j, s.Length - j - 1);
6.12 -string w = "";
char [] charArray = s.ToCharArray();
Array.Reverse( charArray );
w = new string( charArray );
return s+w;
6.11 = return s.Substring(i, s.Length - 1 - i) + s.Substring(j, s.Length - j - 1);
ReplyDelete6.11 Java:
ReplyDeletereturn s.substring(i, s.length()-1)+ s.substring(j,s.length()-1);
using System;
ReplyDeleteusing System.Linq;
public class Program {
public static string Puzzle(string s) {
return s+new string(s.Reverse().ToArray());
}
}
))
ReplyDeleteString y= new StringBuffer(s).reverse().toString();
return s+y;
int start = (s.length()/2)+1;
ReplyDeleteString r = s.substring(start);
String k = r.toUpperCase();
k += s.substring((s.length() /2));
return k;