# A little C# help.

Hello everyone!

I have a question about a loop... Say I am making a velocity calculation, the user enters the time, the calculation happens... BUT I want the program to display the velocities in small increments leading to the final velocity. Say 25 seconds, I wan to to display it increments of 5, 10, 15, 20, & then 25. say in a lablel Now I can get a loop that will go upto 25 but I want it to display each of its results for say

a*t;
t= t+5;
....

Thank you !

Related Programming and Computer Science News on Phys.org
umm...if your input is 25 and you're setting it equal to t you'll have some problems....but i'm not sure if this is the problem you have...

t = 0;
while (t>25);
{ v= a * t;
t = t+ 5;
}

Last edited:
would it work better if you did something like this?:

int t;
int v;

for(i = 0; i i> t; i++)
{
v = a*t;
print(v);
t = t+5;
}

some of the commands aren't really what c# uses, but hopefully you'll get hte idea. the user inputs some time t, you execute a for loop, from 0 to t. you calculate the velocity at t, print the velocity, and then increase t by 5.

Nope that makes an infinite loop. The program freezes.

oh. do i < t then

I think we have to use some sort of a method to store the number and the recall it. I have no clue how to do this. Please anyone if they have an idea please do say so :(

-Job-
int a = someNumber;
}