Goldaram84
?>

Тема массив. напишите на паскале программу, которая запрашивает с клавиатуры массив из n чисел, а затем выводит среднее арифметическое всех элементов массива.

Информатика

Ответы

skvik71672

vari,a,n: integer; sr: real; begin  write('vvedite n = ');   readln(n); // вводите количество чисел в массиве и одновременно вводите диапозон массива от 1 до n  randomize; for i: =1 to n dobegina: =random(n); write(a,' '); sr: =sr+a;   //значения массива складываютсяend; sr : = (sr / n);   //сумма значений массива делится на количество значенийwriteln('srednee arifmeti4eskoe = ',sr: 1: 2); //выводится среднее арифметическоеreadln; end.

optima3559

Решение, которое перебирает

Большие буквы стоят в таблице кодов подряд, то есть, образуют диапазон, нам требуется проверить лежит ли буква в заданном диапазоне. Для русских букв проверять будем так:

if ('А' <= str[0] && str[0] <= 'Я'), для английских нужно просто поменять буквы на английские.

Пример для русских букв:

Программа выводит заглавные буквы

#include <iostream>

#include <string>

#include <windows.h>

signed main() {

SetConsoleCP(1251);

SetConsoleOutputCP(1251);

std::string str;

getline(std::cin, str);

if ('А' <= str[0] && str[0] <= 'Я')

 std::cout << "Первая буква является заглавной!";

else

 std::cout << "Этот символ не является заглавной буквой!";

return 0;

}

MArat

1. Input devices allow you to enter information into a computer for further storage and processing, and output devices allow you to receive information from a computer.

2. Input device types: mouse, keyboard. output device types: monitor.

3. However, regardless of the forms in which they receive their inputs, all input devices must provide a computer with data thare transformed into the binary codes that the primary memory of the computer is designed to accept. This transformation is accomplished by units called I/O interfaces.

4. A reel of magnetic tape upon which the collected data are stored in binary format is an example of a human-independent output.

5. Data enter input units in forms that depend upon the particular device used. For example, data entered from a keyboard in a manner similar to typing, and this differs from the way that data are entered by bar-code scanner.

6. The major differences between devices are the media that they use and the speed with which they are able to transfer data to or from primary storage.

7. It should be noted that the high-speed devices are entirely electronic in their operation or magnetic media that can be moved at high speed.

8. The low-speed devices are those with complex mechanical motion or operate at the speed of a human operator.

Объяснение:

Ответить на вопрос

Поделитесь своими знаниями, ответьте на вопрос:

Тема массив. напишите на паскале программу, которая запрашивает с клавиатуры массив из n чисел, а затем выводит среднее арифметическое всех элементов массива.
Ваше имя (никнейм)*
Email*
Комментарий*

Популярные вопросы в разделе

Pavel1545
office3
argo951385
klykovav672
Александрович Василий
Artak96993298
vladburakoff5
dp199088206
potap-ver20065158
zoocenterivanoff51
oksanakv1950
Болеславовна
ludmila-malev280
DmitrievnaVera
kmb1960679