From 73d8daaf68671bfa699e331b52fc07f904a6ddf1 Mon Sep 17 00:00:00 2001 From: Payal meena Date: Sat, 27 Oct 2018 21:25:39 +0530 Subject: [PATCH] create asciiproduct_1.cpp --- SOLUTIONS/asciiproduct_1.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 SOLUTIONS/asciiproduct_1.cpp diff --git a/SOLUTIONS/asciiproduct_1.cpp b/SOLUTIONS/asciiproduct_1.cpp new file mode 100644 index 00000000..952e8d59 --- /dev/null +++ b/SOLUTIONS/asciiproduct_1.cpp @@ -0,0 +1,23 @@ + +long long productAscii(string str) +{ + long long prod = 1; + + // Traverse string to find the product + for (int i = 0; i < str.length(); i++) { + prod *= (int)str[i]; + } + + + return prod; +} + + +int main() +{ + string str = "payal"; + + cout << productAscii(str); + + return 0; +}