Prime b
posted
420 posts
since
Dec 12, 2011
from
|
|
Re: having a hard time with loops
|
|
|
|
|
|
|
|
|
|
|
Alright John, it's an assignment and it is a pretty easy one. I am a student my self , my advice to you is to try your hardest and post your code here on forums, then we will be able to help you. I did it for you, so you can have a general idea how to solve this problem. Also there's are different ways to solve this, such as using an array.
namespace ForumHelp { class Program { static void Main(string[] args) { int counter=0; // assign variables double largest=0; double number=0;
while (counter != 10) // use while loop 10 times, once counter = 10 quit { counter++; Console.WriteLine("Please enter the sales amount: "); number = Convert.ToInt32(Console.ReadLine());
if (largest < number) // find the largest number { largest = number; } } Console.WriteLine("Larget number is " + largest); // display the number Console.ReadLine(); } } }
|
|
|
|
|
Practice makes it perfect && All science is either computer programming or stamp collecting
|
|
|
|
|
|
john burns
posted
5 posts
since
Feb 22, 2012
from
|
|
Re: having a hard time with loops
|
|
|
|
|
|
|
|
|
|
|
I am trying, each time we get an assignment i go back to the basics and when i want to apply it i get stuck! Thank you so much, appreciate it really
|
|
|
|
|
|
Prime b
posted
420 posts
since
Dec 12, 2011
from
|
|
Re: having a hard time with loops
|
|
|
|
|
|
|
|
|
|
|
Yeah I feel ya, I had same problems, I still have problems. Also when someone helped you click the checkbox to mark as thread as answered
|
|
|
|
|
Practice makes it perfect && All science is either computer programming or stamp collecting
|
|
|
|
|
|