{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

cProgHWFacoTest

cProgHWFacoTest - printf"\n\n\n\n\n\n"...

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

View Full Document Right Arrow Icon
C PROGRAMMING HOMEWORK “FACO-TEST” #include<stdio.h> #include<stdlib.h> int factorial(int); int main() { int number, result; for(;;) { printf("Please Enter A number to get it's factorial: "); //getting our target number scanf("%d", &number); if(number=0) { break; } } //calling the function result = factorial(number + 1); //printing out results printf("\nThe factorial is : %d", result);
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: printf("\n\n\n\n\n\n"); system("PAUSE"); return 0; } int factorial(int victim) { if(victim>1) { victim = victim - 1; /*this is the whole point where you actually call the same function which you are into, it is called a recursive function. */ victim = victim * factorial(victim); } return victim; }...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online