Jump to content

Looking for a bit of help with a school assignment

cab11150904

I am trying to figure out the math of this and I can't seem to get it. Anyone have any idea? Also how do I set the title of the pop up to say input required? I am using vb.net.

qqrzyej.png

Link to comment
Share on other sites

Link to post
Share on other sites

First of all it would be helpful if you gave us what language you're using.

|CPU: Intel i7-5960X @ 4.4ghz|MoBo: Asus Rampage V|RAM: 64GB Corsair Dominator Platinum|GPU:2-way SLI Gigabyte G1 Gaming GTX 980's|SSD:512GB Samsung 850 pro|HDD: 2TB WD Black|PSU: Corsair AX1200i|COOLING: NZXT Kraken x61|SOUNDCARD: Creative SBX ZxR|  ^_^  Planned Bedroom Build: Red Phantom [quadro is stuck in customs, still trying to find a cheaper way to buy a highend xeon]

Link to comment
Share on other sites

Link to post
Share on other sites

First of all it would be helpful if you gave us what language you're using.

See edit.

Link to comment
Share on other sites

Link to post
Share on other sites

You need to give more information on what you're having trouble with. Why is the math giving you trouble? Show us your code so we can see what you've tried and where you might be going wrong.

Link to comment
Share on other sites

Link to post
Share on other sites

I'll give you some pseudo code to start you off.

 

Get the number from the user

-> Is it negative?

-->Yes:

--->Throw an error

--->stop.

-->No

--->Continue.

 

Add all the numbers between one and the input number up.

int sum = 0;for(int i=0; i<=chosenNumber; i++)    sum += i;

You'll need something like that.

Link to comment
Share on other sites

Link to post
Share on other sites

Edit: Take number and inside of a loop, add the value to another int and then subtract 1 from the input value.

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×