Skip to content
This repository has been archived by the owner on Oct 23, 2018. It is now read-only.

added my factorial program #4768

Merged
merged 2 commits into from
Oct 18, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions C/abhishek.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#include<stdio.h>
int main()
{
int c, n;
unsigned long fact = 1;
printf("Enter a number to calculate its factorial\n");
scanf("%d", &n);
for (c = n; c >= 1; c--)
fact *= c;
printf("Factorial of %d = %lu\n", n, fact);
return 0;
}
15 changes: 15 additions & 0 deletions Java/successive_mult.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
class factorial
{
void main()
{
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
int f=1;
for (int i=2;i<=n;i++)
{
f=f*i;
}
System.out.println(f);
}
}