I've been at this for hours, and cant seem to get a grasp on what I should use here. The problem is that I have to add the numbers from 100 counting down, to equal 5005. For example 100+99+98+97 and so on. This problem is probably a lot easier to do than I'm making it out to be.
I tried a do while loop, and several others, but I just dont know which loop to use. Here's my sorry excuse of a program, and if I could just get hints as to what I should use, that'll be appreciated. I want to still try to figure it out, so I'll learn:
Lol, you can see how stumped I was. XD Its supposed to print "100+99+98,...... equal 5005" listing all the integers counting down from 100.Code:#include <stdio.h> int main(void) { int sum = 0; int i = 100; do { sum = sum + i; i = i - 1; } while(sum < 5005); printf("%d %d, ", i, sum); }