Const n=10; var i,m,k:integer; a:array[1..n] of integer; begin Randomize; Write('Исходный массив: '); for i:=1 to n do begin a[i]:=Random(90)+10; Write(a[i],' ') end; Writeln; Writeln('Введите целое число: '); Read(m); k:=0; for i:=1 to n do if a[i]<m then Inc(k); Writeln('Количество чисел, меньших ',m,' равно ',k) end.
#include <cstdlib>#include <iostream>#include <iomanip>#include <cmath> using namespace std; int main(){ setlocale(0, ""); double x, y, a, b, xk, xn, dx; a = 1.4; b = 2.5; cout << "Ââåäèòå xn,xk, dx = " << endl; cin >> xn; cin >> xk; cin >> dx; x = xn; cout << "Tabl" << endl; cout << "+-----------+" << endl; cout << "¦ x ¦ y ¦" << endl; while (x <= xk) { y = (log10(a*x*x+b))/(a*x+1); cout << "+-----+-----¦" << endl; cout.setf(ios::fixed); cout.precision(3); cout << "¦" << x << "¦"<< y << "¦" << endl; x = x + dx; } cout << "+-----------+"; system("pause");}
Makarov
10.01.2021
import java.util.Scanner;
/** * Created by Geek on 20.09.2016. */ public class getTime { public static void main(String[] agrs){ Scanner in = new Scanner(System.in); // Создаем объект ввода через консоль System.out.print("Сколько минут после начала дня:"); int n = in.nextInt(); if(n <= 59) { System.out.print(String.format(" часов и %d минут",n)); } else if(n > 1440) { n = n - ((n/1440)*1440); System.out.print(String.format(" часиков и %d минут",n/60,n%60)); } else { System.out.print(String.format(" часиков и %d минут",n/60,n%60)); }
n=10;
var
i,m,k:integer;
a:array[1..n] of integer;
begin
Randomize;
Write('Исходный массив: ');
for i:=1 to n do begin a[i]:=Random(90)+10; Write(a[i],' ') end;
Writeln;
Writeln('Введите целое число: '); Read(m);
k:=0;
for i:=1 to n do
if a[i]<m then Inc(k);
Writeln('Количество чисел, меньших ',m,' равно ',k)
end.
Тестовое решение:
Исходный массив: 42 89 49 25 96 87 94 93 41 28
Введите целое число:
50
Количество чисел, меньших 50 равно 5