# New Coding Program | Set-5 SOLVED | codewindow.in ### Example 2

#### There are three words in input1.Consider the first word: aaa. Sum of ASCII = 97*3 = 291. It is an odd value.Consider the second word: bb. Sum of ASCII = 98*2 = 196. It is an even value.Consider the third word: cc. Sum of ASCII = 99*2 = 198. It is an even value. So, totally, 1 odd and 2 even ASCII sums are there. Hence, return ‘odd1even2’ as answer. #### Solution: In Java

``````import java.util.*;
import java.lang.*;
import java.io.*;

class CodeWindow
{
static void findAsciSumOddEven(String[] str) {
int odd = 0, even = 0;
for(int i=0; i<str.length; i++) {
int total = 0;
for(int j=0; j<str[i].length(); j++) {
total += str[i].charAt(j);
}
if(total%2 == 0)
even++;
else
odd++;
}
System.out.println("odd" + odd + "even" + even);
}

public static void main (String[] args) throws Exception
{
findAsciSumOddEven(str);
}
}
``````

### Example 1

#### Solution: In Java

``````import java.util.*;
import java.lang.*;
import java.io.*;

class CodeWindow
{
public static void main (String[] args) throws Exception
{
int total = 0;
for(int i=0; i<5; i++) {
total += val;
System.out.println(total);
}
}
}
``````

### Example 1

#### Solution: In Java

``````import java.util.*;
import java.lang.*;
import java.io.*;

class CodeWindow
{
static char returnDig(String n) {
if(n.equals("zero")) return '0';
else if(n.equals("one")) return '1';
else if(n.equals("two")) return '2';
else if(n.equals("three")) return '3';
else if(n.equals("four")) return '4';
else if(n.equals("five")) return '5';
else if(n.equals("six")) return '6';
else if(n.equals("seven")) return '7';
else if(n.equals("eight")) return '8';
return '9';
}
public static void main (String[] args) throws Exception
{
String number = "";
boolean d = false, t = false;
for(int i=0; i<str.length; i++) {
if(d == true) {
number += "" + returnDig(str[i]) + returnDig(str[i]);
d = false;
}
else if(t == true) {
number +=  "" + returnDig(str[i]) + returnDig(str[i]) + returnDig(str[i]);
t = false;
} else {
if(str[i].equals("double")) d = true;
else if(str[i].equals("triple")) t = true;
else number += returnDig(str[i]);
}
}
System.out.println(number);
}
}
`````` 