Практикум по программированию. Основы. Циклы. Табулирование функции

From AsIsWiki
Revision as of 16:39, 4 April 2015 by Alex (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Циклы


Contents

Java

import java.util.Scanner;

public class Task08 {

    public static void main(String[] args) {
        
        Scanner in = new Scanner(System.in);
        
	System.out.println();
        System.out.println(" Табулирование функции Y = X^2 + 1 ");
        System.out.println("    на отрезке [A, B] с шагом H    ");
        System.out.println("----------------------------------");

        System.out.print(" Введите границы отрезка A и B: "); 
	double a = in.nextDouble();
	double b = in.nextDouble();

        System.out.print(" Введите шаг табулирования H: "); 
	double h = in.nextDouble();

        System.out.println("----------------------------------");

	System.out.println("     X        Y");

	for (double x = a; x <= b; x += h) {
	    System.out.printf(" %8.3f %8.3f\n", x, x * x + 1);
	}
    }
}


C++



Pascal




Циклы

Personal tools
Namespaces

Variants
Actions
Navigation
Tools