i need to make a small program:
A) write a program that reads a positive integer and displays its factorial. the program output should look similar to:
enter an interger: 5
5! = 120
B) 0! is identified as 1 , but all negative factorial are considered to be undefined. modify the factorial program to ask the user for an integer until a positive integer or 0 is entered. the output should look similar to:\
enter an integer: -5
-5! is undefined
enter an integer 0
0! = 1
i think this program needs to use loops and im not that certain on how to use them because we just learned it and i dont really understand much but i do know a little. i tried to start it.... here is my code
- Code: Select all
#include <iostream.h>
int main()
{
int num, fact;
cout<<endl<<"Enter an integer";
cin>>num;
cout<<endl<<num<<"!="<<fact;
for(i=0; i<=n; i--)
}
