Практикум по программированию. Основы. Ввод и вывод. Точка на отрезке
From AsIsWiki
(Difference between revisions)
(Created page with "<div style='max-width:700px;text-align:justify;'> Ввод и вывод __...") |
Revision as of 14:56, 4 April 2015
Contents |
Java
import java.util.Scanner; public class Task12 { public static void main(String[] args) { Scanner in = new Scanner(System.in); System.out.println(); System.out.println(" Поиск координат точки M(X, Y) на отрезке [N1, N2] "); System.out.println("---------------------------------------------------"); System.out.print(" Введите координаты X1 и Y1 точки N1: "); double x1 = in.nextDouble(); double y1 = in.nextDouble(); System.out.print(" Введите координаты X2 и Y2 точки N2: "); double x2 = in.nextDouble(); double y2 = in.nextDouble(); System.out.print(" Введите отношение Z = |N1, M| / |M, N2|: "); double z = in.nextDouble(); System.out.println("---------------------------------------------------"); double x = (z * x2 + x1) / (1 + z); double y = (z * y2 + y1) / (1 + z); System.out.printf(" Координаты точки М: X = %.2f; Y = %.2f\n", x, y); } }
C++
Pascal