- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathA95.java
More file actions
Latest commit
31 lines (26 loc) · 484 Bytes
/
Copy pathA95.java
File metadata and controls
31 lines (26 loc) · 484 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
classA95
{
publicstaticvoidmain(String[] args)
{
inta[] = {2,3,7,10,8,9};
System.out.println("---- PROGRAM will PRINT factorial of each no. from an ARRAY ----- ");
for (inti=0;i<a.length ;i++ )
{
if (a[i]<10)
{
intfact = 1;
intdigit = a[i];
while(digit>0)
{
fact = fact*digit;
digit--;
}
a[i]=fact;
}
}
for (intj=0;j<a.length ;j++ )
{
System.out.print(a[j]+" " );
}
}
}