+
۲

برنــــــــــــامه نویسی تمرکز - فاکتوریل به زبان جاوا (اینجا کلیک کنید)

برنــــــــــــامه نویسی تمرکز - فاکتوریل به زبان جاوا

import java.util.Scanner;

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

/**
*
* @author sara
*/
//n!
public class fact {
public static void main(String[] args) {
Scanner sara=new Scanner(System.in);
System.out.println("ente one number : ");
int n=sara.nextInt();
int fact=1;
for (int i = 1; i <= n; i++) {
fact*=i;
}
System.out.println(" fact of n = "+fact);
}

}

 

رای دهندگان

دیدگاهتان را بنویسید