EXERCİSE 4 / lab 7

PHOTO EMBED

Wed Dec 07 2022 15:51:29 GMT+0000 (Coordinated Universal Time)

Saved by @Mohamedshariif

/*Exercise 4
Write a function called factorialN that will take an integer number n as input, and calculate
1*2*3…*n
and print the result on the screen.
Hint: the function header will be 
void factorialN (int n)*/



#include <stdio.h>
#include <stdlib.h>
void factorialN(int number);
int main() {
    int number;
    int product=1;
    printf("please enter a number: ");
    scanf("%d",&number);
    
    int i;
    for(int i=1;i<=number;i++)
    {
        product=product*i;
    }
    printf("the product between 1 and %d is = %d",number,product);
    
    
return 0;
}
content_copyCOPY