int p=1,i ,n;
n=sc.nextInt();
for(i=1; i <=n;i++)
p=p*i;
System.out.println(p);
convert -do while loop
Answers
Answered by
0
Answer:
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
int p = 1, i = 1, n;
Scanner sc = new Scanner(System.in);
n = sc.nextInt();
do {
p = p*i;
i++;
} while (i <= n);
System.out.println(p);
}
}
Similar questions