ass5sol - Introduction to Computer Engineering 1 Assignment...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Assignment 5 Datapaths Due Date: 5:00 PM Wednesday 31 th March 2010 Question 1 /*----------------------------------------------------------------------*/ /* Program Name: factorial */ /* Function: Computes the factorial of a command line */ /* argument. */ /* Usage: % factorial [long] */ /* Author: Julien Cassis */ /* Date: March 22, 2010 */ /*----------------------------------------------------------------------*/ #include <stdio.h> void factorial (long argument, long *result); int main (int argc, char *argv[]){ long argument, result; if (argc != 2) { printf("Usage: factorial [long]\n"); return(0); } sscanf(argv[1],"%ld",&argument); factorial(argument,&result); printf("%ld! = %ld\n",argument,result); return(0); } /*----------------------------------------------------------------------*/ /* Recursive factorial function */ /* void factorial (long argument, long *result) */ /*----------------------------------------------------------------------*/ void factorial (long argument, long *result){
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 7

ass5sol - Introduction to Computer Engineering 1 Assignment...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online