+ 5
How do I multiply string?
I have a string of '5,6' as user input, How do i multply to get the answer 5*6= 30
6 Respostas
+ 12
Ashraf
You can do like this
string str = Console.ReadLine();
string[] arr = str.Split(",");
int mult = 1;
foreach(string s in arr) {
mult = mult * Convert.ToInt32(s);
}
Console.WriteLine(mult);
+ 6
Ashraf Convert the String into integer array and multiply the values.
+ 6
Thanks AJ Anant - C#/Java Challenger bro and alll others
+ 3
if your input is a string, you have to parse it to get the integers.
just google c# parse string
+ 2
~ swim ~ can you please show me an example!
0
By casting