0
is there another code to print the factorial of the numbers from 1 to ten
#include <iostream> using namespace std; int main() { int number , fact=1; for(number=1;number<=10;number++) { for(int i=1;i<=number;i++) fact*=i; cout<<"the factorial of "<< number <<" is "<<fact<<"\n"; fact=1; } return 0; }
2 Respuestas
+ 1
Recusive and iterative programm code can always be converted to each other :) so there are many ways to do this 😋
and you could shorten your code :)
+ 2
U can use recursive function to do the same...