Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package day2_factorial;
- import java.util.Scanner;
- /**
- *
- * @author sao_7
- */
- public class Day2_factorial {
- /**
- * @param args the command line arguments
- */
- public static void main(String[] args) {
- Scanner sc = new Scanner(System.in);
- System.out.println("Ievadiet skaitli!");
- long number = sc.nextInt();
- //for cikls, kas aprekina faktoriali
- int fact = 1;
- for(int i = 1; i<=number; i++){
- fact = fact * i;
- }
- System.out.println("Faktorialis ir " + fact);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement