khoob study

Tuesday, February 28, 2023

Program for factorial in java?

Program for factorial in java

 import java.util.*;

class factorial

{

public static void main(String hg[])

{

int n,i,f=1;

Scanner o = new Scanner(System.in);

System.out.print("enter any number ");

n= o.nextInt();

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

{

f=f*i;

}

System.out.print("factorial is" +f);

}


Read more:https://www.blogger.com/u/1/blog/post/edit/1762363558058026986/8124962187061736631

https://khoobstudy.blogspot.com/2022/11/write-program-to-hello-word.html


No comments:

Post a Comment