please help me solving this problem
i m new to Programming. Please help me solving this Question .. thanks .. i m doing this like ... having some logical error
Assuming the ocean’s level is currently rising at about 1.5 millimeters per year; write a program that displays a table
showing the number of millimeters that the ocean will have risen each year for the next 25 years.:confused:
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
double rate = 1.55;
for (double year = 1; year <= 25; year++)
{
rate = rate * year;
Console.WriteLine(rate);
}
}
}
}
Re: please help me solving this problem
Hi, welcome to the forum.
First, please use [code] and [/code] tags to keep your source code formatted and easy to read (I have fixed your initial submission).
Second, the problem is that the prompt says the rate is constant, yet you modify the value of rate with every iteration through the loop. What you want to compute is the total amount of increase which is given by the formula:
Risen = Rate * Years
Do you see how to implement this?
Re: please help me solving this problem
yeah got that .. thanks biophycengr for help :)
Regards
Danyal
Re: please help me solving this problem
Nice contribution @ BioPhysEngr.