Commit 5e3183af authored by Artak Yenokyan's avatar Artak Yenokyan

Merge branch 'exercise_05_10' into 'master'

Mary Zaqaryan Exercise_05_10 Version1

See merge request bpcarm/trainings2017!1309
parents d9fa70ab c141298e
We can't count factroial of 20 because it is enormous number and can not be fit in integer number.
#include <iostream>
int
main()
{
int factorial = 1;
for (int i = 1; i <= 5; ++i) {
factorial *= i;
std::cout << "Factorial of number " << i << " is " << factorial << std::endl;
}
return 0;
}
exercise_05_10: exercise_05_10.o | .gitignore
g++ $^ -o $@
exercise_05_10.ii: exercise_05_10.cpp
g++ -E $^ -o $@
exercise_05_10.s: exercise_05_10.ii
g++ -S $^ -o $@
exercise_05_10.o: exercise_05_10.s
g++ -c $^ -o $@
.gitignore:
echo "exercise_05_10" > $@
removes:
rm *.ii *.s *.o *.out exercise_05_10 .gitignore
test: exercise_05_10
./exercise_05_10 > test.out
diff test.out test.expected > /dev/null 2>&1 && echo PASSED || echo FAILED
Factorial of number 1 is 1
Factorial of number 2 is 2
Factorial of number 3 is 6
Factorial of number 4 is 24
Factorial of number 5 is 120
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