will calculate and display the sum of all even even numbers from 2 to n, where n is a positive number inputted by the user..what will i do and what is the expression of that???
hoceandress 0
Newbie Poster
Recommended Answers
Jump to PostSo, you are having trouble with language constructs or logic?
Jump to PostThe statement
e=e%2;
will result in e being equal to the remainder of the division of e by 2. In other words, if e is even, e will become 0, if e is odd, e will become 1, and e will not change after that no matter …
Jump to Postyou might not want to use a do while loop in case the user enters a value less than 1.
also e++ doesn't need to be a part of the conditional check
and you need to check if the value of e%2 is a multiple of 2 before …
All 10 Replies
SpS 34
Posting Pro
hoceandress 0
Newbie Poster
darkagn 315
Veteran Poster Featured Poster
jsap 0
Newbie Poster
SpS 34
Posting Pro
dougy83 74
Posting Whiz in Training
darkagn 315
Veteran Poster Featured Poster
hoceandress 0
Newbie Poster
SpS 34
Posting Pro
darkagn 315
Veteran Poster Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.