По разделам

 

Решение задачи Series 21


Дано целое число N (> 1) и набор из N вещественных чисел. Проверить, образует ли данный набор возрастающую последовательность. Если
образует, то вывести TRUE, если нет — вывести FALSE.

Код (C/C++)

#include <stdio.h>
int main(void)
{
    int n;
    printf("N:");
    scanf("%i", &n);
    int i,rez=1;
    float r,r1;
    for (i=1; i<=n; ++i, r1=r){
        printf(">");
        scanf("%f", &r);
        if ((r1>r)&&(i!=1)) rez=0;
    }
    printf("%s\n",rez?"True":"False");
    return 0;
}

Код (Python)

import random

N = random.randrange(2,20)
print("N = ",N)

#x = 1
x = random.randrange(1,10)
x_prev = x
flag = True
for i in range(1,N):
    #x = i+1
    x = random.randrange(1,10)
    if x_prev >= x:
        flag = False
        #break
    print(x_prev,end="; ")
    x_prev = x
print(x)

print("Result = ",flag)
									

Код (Pascal)

program Series21;
var
  i,N,Num,Num1,El :Integer;
  b:boolean;
begin
 b:=TRUE;
 El:=0;
 Write('N:');
 Readln(N);
 for i:=1 to N do
   begin
    write('Введите ',i,' элемент последовательности :');
    Readln(Num);
    if (((Num1>Num) and (i<>1)) and b) then
     begin
      El:=Num;
      b:=FALSE;
     end;
     Num1:=Num;
   end;
  Writeln(El);
end.
									

Дополнительно

n = int(input())
temp = float(input())
t = temp
b = True
for i in range(n - 1):
    temp = float(input())
    if temp < t:
        b = False
    t = temp
print(b)
									



Series. Абрамян
Series 1 Просмотров: 4664
Series 2 Просмотров: 2402
Series 3 Просмотров: 2189
Series 4 Просмотров: 2364
Series 5 Просмотров: 2238
Series 6 Просмотров: 2855
Series 7 Просмотров: 3066
Series 8 Просмотров: 3386
Series 9 Просмотров: 2059
Series 10 Просмотров: 2503
Series 11 Просмотров: 1898
Series 12 Просмотров: 2272
Series 13 Просмотров: 1667
Series 14 Просмотров: 1578
Series 15 Просмотров: 1889
Series 16 Просмотров: 2290
Series 17 Просмотров: 2088
Series 18 Просмотров: 2934
Series 19 Просмотров: 2631
Series 20 Просмотров: 1668
Series 21 Просмотров: 1815
Series 22 Просмотров: 1803
Series 23 Просмотров: 2245
Series 24 Просмотров: 2022
Series 25 Просмотров: 1558
Series 26 Просмотров: 1416
Series 27 Просмотров: 1325
Series 28 Просмотров: 1279
Series 29 Просмотров: 1302
Series 30 Просмотров: 1336
Series 31 Просмотров: 1316
Series 32 Просмотров: 1854
Series 33 Просмотров: 1099
Series 34 Просмотров: 1150
Series 35 Просмотров: 1531
Series 36 Просмотров: 1628
Series 37 Просмотров: 1060
Series 38 Просмотров: 1384
Series 39 Просмотров: 996
Series 40 Просмотров: 1373

Комментарии

Чтобы написать комментарии вам нужно войти в систему или зарегистрироваться



Заявка на расчет