-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoddsASCII
More file actions
33 lines (27 loc) · 772 Bytes
/
oddsASCII
File metadata and controls
33 lines (27 loc) · 772 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
using System;
using System.Linq;
using System.IO;
using System.Text;
using System.Collections;
using System.Collections.Generic;
/**
* Auto-generated code below aims at helping you parse
* the standard input according to the problem statement.
**/
class Solution
{
static void Main(string[] args)
{
string word = Console.ReadLine();
// Write an action using Console.WriteLine()
// To debug: Console.Error.WriteLine("Debug messages...");
int count = 0;
byte[] asciiBytes = Encoding.ASCII.GetBytes(word);
for(int i = 0 ; i < word.Length ; i++)
{
if(asciiBytes[i]%2==1)
count += asciiBytes[i];
}
Console.WriteLine(count);
}
}