For examples rewritten

This commit is contained in:
Mert Gör 🇹🇷 2024-06-24 18:41:10 +03:00
parent a8d24e2f4d
commit 2b2613c101
Signed by: hwpplayer1
GPG Key ID: 03E547D043AB6C8F
3 changed files with 20 additions and 1 deletions

View File

@ -1,5 +1,7 @@
2024-06-24 hwpplayer1 <hwpplayer1@debian>
* src/for_example_2.cpp: another for example
* src/for_example.cpp: For example sum of 1 to 10 inclusive is ...
* src/sum_numbers.cpp (main): Sum of 50 to 100 inclusive is ...

View File

@ -5,7 +5,9 @@ int main()
int sum = 0;
for (int value = 1; value <= 10; ++value)
sum += value;
sum += value;
std::cout << "Sum of 1 to 10 inclusive is "
<< sum << std::endl;
return 0;

15
src/for_example_2.cpp Normal file
View File

@ -0,0 +1,15 @@
#include <iostream>
int main()
{
int sum = 0;
for (int value = 1; value <= 5; ++value)
{
sum += value;
}
std::cout << "Sum of 1 to 10 inclusive is "
<< sum << std::endl;
return 0;
}