google.com, pub-6167773875660516, DIRECT, f08c47fec0942fa0 Write a program to find the factorial of a given number - 2nd puc computer science

Write a program to find the factorial of a given number

Write a program to find the factorial of a given number

#include<stdio.h>

#include<conio.h>

void main()

{

int n,fact=1,i;

clrscr();

printf("Enter the number: ");

scanf("%d",&n);

for(i=1;i<=n;i++)

fact=fact*i;

printf("%d!=%d",n,fact);

getch();

}

Output:

Enter the number: 5

5!=120               


Write a program to find the factorial of a given number Write a program to find the factorial of a given number Reviewed by Vision Academy on December 08, 2021 Rating: 5

No comments:

CheckOut

Powered by Blogger.