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
Song Lee
NA
47
38.6k
Program that adds input numbers until user inputs "0"
Sep 24 2014 7:05 PM
Hello again, C# corner users!
I need to make a program that will add numbers that user inputs, until user inputs 0.
It should look like this at the end:
----------------------------------------------------
[Summation of Real numbers]
Write 0 to Finish
Write an amount to sum or 0 to finish:
50
Write an amount to sum or 0 to finish:
40
Write an amount to sum or 0 to finish:
10.5
Write an amount to sum or 0 to finish:
0
The sum is :
100.5
----------------------------------------------------
Below are the outlines that I got so far:
Thanks for your help guys!
public class
FloatNumbersWhileAdd
{
private double
sum;
public void
Start()
{
WriteProgramInfo();
ReadInputAndSumNumbers();
ShowResults();
}
private void
WriteProgramInfo()
{
//
Coding part here
}
private void
ReadInputAndSumNumbers()
{
bool
done =
false;
while
(!done)
{
//
Coding part here
}
}
private double
ReadInput()
{
Console
.Write("
Write an amount to sum or zero to finish
: ");
double
num =
double
.Parse(
Console
.ReadLine());
return
num;
}
private void
ShowResults()
{
// Coding part here
}
}
}
Reply
Answers (
3
)
C# Topics
What is the code to copy a file to a system32 folder