Write, compile, and execute a C++ program to calculate the sum of the numbers from 1 to 100. The formula for calculating this sum is sum = (n/2)(2*a + (n-1)d), where n = number of terms to be added, a = the first number, and d= the difference between each number. Your program should produce the display
The sum of the number is xxxx.
where the xxxx represents a field width of four digits and should be replaced by the sum computer by the program.
Shamar_1
0
Newbie Poster
Recommended Answers
Jump to PostYou need to read the rules of this forum, especially the rule that reads as follows:
Do provide evidence of having done some work yourself if posting questions from school or work assignments
Don't copy-paste your homework assignments (or other exercises) and expect people to simply give out a …
All 4 Replies
mike_2000_17
2,669
21st Century Viking
Team Colleague
Featured Poster
NathanOliver
429
Veteran Poster
Featured Poster
triumphost
commented:
Lol. I like this quote. Stealing it!
+8
rubberman
1,355
Nearly a Posting Virtuoso
Featured Poster
David W
131
Practically a Posting Shark
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.