I designed a windows application form NAVIGATOR, and put the following code to the form.
When I am passing the parameters "string" and "int" to the function Hereitis. e.g if I pass "naveen" and "1", then It's output must be as:
HI naveen
HI naveen naveen but in second time or further as per the "numberoftimes" it always prints HI naveen only. why the value of finalstring is not getting modified each time for loop runs..????
namespace Navigator
{
class Talker
{
public static int Hereitis(string thingTosay, int numberoftimes)
{
string finalstring = " HI ";
for (int count = 0; count <= numberoftimes; count++)
{
finalstring = finalstring + thingTosay + "\n";
}
MessageBox.Show(finalstring);
return finalstring.Length;
}

Vipul MalhotraRank #276 · 9.1K reputationPosted Apr 7, 2016, 2:10 AM EDT
Vipul MalhotraRank #276 · 9.1K reputationPosted Apr 6, 2016, 10:47 PM EDT
Nishant MittalRank #692 · 3.5K reputationPosted Apr 6, 2016, 11:04 PM EDT
NAVEEN PANERU25 reputationPosted Apr 7, 2016, 12:26 AM EDT
Nishant MittalRank #692 · 3.5K reputationPosted Apr 7, 2016, 12:30 AM EDT
NAVEEN PANERU25 reputationPosted Apr 7, 2016, 12:37 AM EDT
NAVEEN PANERU25 reputationPosted Apr 7, 2016, 12:57 AM EDT
Shubham KumarRank #621 · 3.8K reputationPosted Apr 7, 2016, 12:57 AM EDT
NAVEEN PANERU25 reputationPosted Apr 7, 2016, 1:01 AM EDT
Shubham KumarRank #621 · 3.8K reputationPosted Apr 7, 2016, 1:05 AM EDT
NAVEEN PANERU25 reputationPosted Apr 7, 2016, 1:08 AM EDT
Shubham KumarRank #621 · 3.8K reputationPosted Apr 7, 2016, 1:10 AM EDT
Vipul MalhotraRank #276 · 9.1K reputationPosted Apr 7, 2016, 1:14 AM EDT
NAVEEN PANERU25 reputationPosted Apr 7, 2016, 1:19 AM EDT
Vipul MalhotraRank #276 · 9.1K reputationPosted Apr 7, 2016, 1:21 AM EDT
NAVEEN PANERU25 reputationPosted Apr 7, 2016, 1:24 AM EDT
Vipul MalhotraRank #276 · 9.1K reputationPosted Apr 7, 2016, 1:25 AM EDT
NAVEEN PANERU25 reputationPosted Apr 7, 2016, 1:27 AM EDT
NAVEEN PANERU25 reputationPosted Apr 7, 2016, 1:29 AM EDT
Vipul MalhotraRank #276 · 9.1K reputationPosted Apr 7, 2016, 1:33 AM EDT
Shubham KumarRank #621 · 3.8K reputationPosted Apr 7, 2016, 1:41 AM EDT
Nishant MittalRank #692 · 3.5K reputationPosted Apr 7, 2016, 1:44 AM EDT
NAVEEN PANERU25 reputationPosted Apr 7, 2016, 1:54 AM EDT
NAVEEN PANERU25 reputationPosted Apr 7, 2016, 1:57 AM EDT
NAVEEN PANERU25 reputationPosted Apr 7, 2016, 2:17 AM EDT