Wednesday, 8 March 2017

C Program to calculate the product of N Natural numbers

C program to calculate the product of N Natural numbers is given below:


#include <stdio.h>
int main()
{
    int N,p=1,i;
    scanf("\n%d",&N);
    for(i=1;i<=N;i++)
        p=p*i;
    printf("Product is %d\n",p);

}

OUTPUT:

 


EmoticonEmoticon