Tech
Forums
Jobs
Books
Events
Interviews
Live
More
Learn
Training
Career
Members
Videos
News
Blogs
Post
An Article
A Blog
A Video
An Ebook
An Interview Question
Register
Login
25
Reply
problem while running for loop.
NAVEEN PANERU
8 years ago
654
Reply
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;
}
Post
Reset
Cancel
Answers (
25
)
Next Recommended Forum
how to build for loop for my code
crystal reports from store procedure in windows application?