{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

factorial - else if(a<0...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
#include <iostream> using namespace std; int main(){ int a,b=1; cout<< "Welcome to the Factorial Machine! To see the factorial of any number, please enter that number now!"<<endl; cin>>a; if(a==0){ cout<< "0!=1. Thank You!"<<endl;
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: } else if (a<0){ cout<<a<<"!="<<a<<"/0, which is Undefined! Thank You!"<<endl; } else if(a>0){ for(int c=1;c<=a;c++){ b=b*c; } } cout<<a<<"!="<<b<<endl; return 0; }...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online