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&lt;0){ cout&lt;&lt;a&lt;&lt;&quot;!=&quot;&lt;&lt;a&lt;&lt;&quot;/0, which is Undefined! Thank You!&quot;&lt;&lt;endl; } else if(a&gt;0){ for(int c=1;c&lt;=a;c++){ b=b*c; } } cout&lt;&lt;a&lt;&lt;&quot;!=&quot;&lt;&lt;b&lt;&lt;endl; return 0; }...
View Full Document

This note was uploaded on 09/15/2011 for the course ENGINEERIN 14:440:127 taught by Professor Brendacortez during the Fall '10 term at Rutgers.

Ask a homework question - tutors are online