From 8e21732f19ce56080d5861589c980e5222481f64 Mon Sep 17 00:00:00 2001 From: fitel17112 Date: Sat, 1 Mar 2025 03:49:56 +0530 Subject: [PATCH] 010 --- get_count.v | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 get_count.v diff --git a/get_count.v b/get_count.v new file mode 100644 index 0000000..73ff9dc --- /dev/null +++ b/get_count.v @@ -0,0 +1,13 @@ +fn get_count(str string) int { + mut count := 0 + for r in 0 .. str.len { + if str[r] == `a` || str[r] == `e` || str[r] == `i` || str[r] == `o` || str[r] == `u` { + count++ + } + } + return count +} + +fn main() { + println(get_count('hello')) +}