Esercitazione 3 1) Write a program which evaluate the factorial of a given number n. Use a for loop. (factorial.cpp) bash$ ./factorial Give me an integer: 12 12! = 479001600 2) Write a program which determines the number of digits of a given number using a while loop. (numersOfDigits.cpp) (Tip: using the rules of divisions between integers, divide the number by 10, until the results is 0. The number of divisions is the number of digits of the integer.) bash$ ./numerofDigits Give me an integer: 12345 12345 has 5 digits 3) Write a program that prints the position of a body moving with a uniformly accelerated motion every deltaT seconds for n times. (motion.cpp) bash$ ./motion Print the position of a body moving with a uniformly accelerated motion every deltaT seconds for n times Give me acceleration, velocity and x0 4 6 8 How many times do you want to print the position ? 10 Delta T ? 2 x(t): 8 t= 0 seconds x(t): 28 t= 2 seconds ........... x(t): 928 t= 20 seconds 4) A ball, dropped from a given height, rebounds reaching at every rebound half of the height of the previous rebound.   Write a program that prints the ball rebounds until the height of the rebound is less than a pre-set tolerance (rebound.cpp) bash$ ./rebound Initial height: 10 Rebound # 1: height 5 meters Rebound # 2: height 2.5 meters .............. Rebound # 14: height 0.000610352 meters 5) Write a program that determines whether a given number is prime or not (PrimeNumber.cpp) bash$ ./primenum Give me an integer 8 Number 8 is not prime bash$ ./primenum Give me an integer 7 Number 7 is prime