Write a for loop that assigns summedvalue with the sum of all odd values from 1 to usernum. assume usernum is always greater than or equal to 1. ex: if usernum is 5, then summedvalue is 9 (i.e. 1 + 3 + 5 = 9).
Question
Answer:
I don't know which language you use those, so I assume that you use c++for (int i = 1; i <= userNum; i++)
{
summedValue = summedValue + i;
i = i + 1;
}
solved
general
10 months ago
5516