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.
Jump to Post
You 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
We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.