Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Calcula o tamanho médio das linhas digitadas pelo usuário
- import std.stdio;
- void main() {
- ulong lines = 0;
- double sumLength = 0;
- foreach (line; stdin.byLine()) {
- ++lines;
- sumLength += line.length;
- }
- writeln("Tamanho médio da entrada: ",
- lines ? sumLength / lines : 0);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement