Commit e893d4fc authored by Artak Yenokyan's avatar Artak Yenokyan

Merge branch 'exe_09' into 'master'

Exercise_05_09, Version1

See merge request bpcarm/trainings2017!1192
parents 985abe57 6b527bb3
exercise_05_09: main.o | .gitignore
g++ $^ -o $@
main.ii: main.cpp
g++ -E $^ -o $@
main.s: main.ii
g++ -S $^ -o $@
main.o: main.s
g++ -c $^ -o $@
.gitignore:
echo "exercise_05_09" > $@
clean:
rm *.ii *.s *.o *.out exercise_05_09 .gitignore
test: exercise_05_09
@./exercise_05_09 > test.out
@diff test.out test.expected > /dev/null 2>&1 && echo PASSED || echo FAILED
.PRECIOUS: main.ii main.s
.SECONDARY: main.ii main.s
#include <iostream>
int
main()
{
int product = 1;
for (int i = 3; i <= 15; i += 2) {
product *= i;
}
std::cout << "The product of the odd integers from 1 to 15 is " << product << std::endl;
return 0;
}
The product of the odd integers from 1 to 15 is 2027025
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment