TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Prime b
NA
810
345.8k
Problem with loops
Jan 4 2012 11:42 PM
So this is the problem
Write a console-based application that displays all
even numbers from 2 to 100, inclusive.
This is my solution to it
double max = 50;
double math;
for (int x = 1; x <= max; ++x)
{
math = x * 2;
Console.WriteLine(math);
}
So simple lol, but it took me a minute to think of it. Also any other way to do this problem?
Then there's part B, Create a GUI application that displays all the even numbers
from 2 to 100 inclusive when the user clicks a button.
This is my solution
private void button1_Click(object sender, EventArgs e)
{
double max = 50;
double math;
for (int x = 1; x <= max; ++x)
{
math = x * 2;
label1.Text = String.Format("{0}", math);
}
But all it does is display 100, the only number..
Reply
Answers (
2
)
how to play wav files according to inputs given?
Another loop !