Sum of 50 to 100 inclusive is ... and ChangeLog update
This commit is contained in:
parent
0849707d7b
commit
286258cc37
2 changed files with 18 additions and 0 deletions
|
@ -1,4 +1,6 @@
|
||||||
2024-06-24 hwpplayer1 <hwpplayer1@debian>
|
2024-06-24 hwpplayer1 <hwpplayer1@debian>
|
||||||
|
|
||||||
|
* src/sum_numbers.cpp (main): Sum of 50 to 100 inclusive is ...
|
||||||
|
|
||||||
* src/while_statement.cpp (main): While example written
|
* src/while_statement.cpp (main): While example written
|
||||||
|
|
||||||
|
|
16
src/sum_numbers.cpp
Normal file
16
src/sum_numbers.cpp
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
int sum = 0, value = 50;
|
||||||
|
|
||||||
|
while(value <= 100)
|
||||||
|
{
|
||||||
|
sum += value;
|
||||||
|
++value;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::cout << "Sum of 50 to 100 inclusive is " << sum << std::endl;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue