Практикум по программированию. Основы. Циклы. Факториал

From AsIsWiki
Revision as of 07:24, 14 April 2015 by Alex (Talk | contribs)

Jump to: navigation, search

Назад · Задачи · Дальше


Contents

Java

import java.util.Scanner;

public class Task02 {

    public static void main(String[] args) {
        
        Scanner in = new Scanner(System.in);
        
	System.out.println();
        System.out.println(" Расчет факториала ");
        System.out.println("-------------------");

        System.out.print(" Введите число: "); 
	long n = in.nextLong();

        System.out.println("-------------------");
        
	long p = 1;

	for (long i = 1; i <= n; i++) {
	    p *= i;
	}

	System.out.printf(" %d! = %d\n", n, p);
    }
}


C++



Pascal




Назад · Задачи · Дальше

Personal tools
Namespaces

Variants
Actions
Navigation
Tools