
ДАНО СЛОВО ДЛИНОЙ НЕ МЕНЕЕ 8 СИМВОЛОВ НАПИСАТЬ ПРОГРАММУ КОТОРАЯ ПЕРЕНОСИТ 1 БУКВУ В КОНЕЦ СЛОВА


Ответы на вопрос

uses crt;
var
s:string;p:char; i:integer;
begin
write('Введи слово, в котором не менее 8 букв: '); readln(s);
if length(s)<8 then write('Вы ввели слишком короткое слово.')
else
begin
p:=s[1];
for i:=1 to length(s) do
s[i]:=s[i+1];
s[i]:=p;
write(s);
end;
end.



Program to Move a Letter to the End of a Word
To write a program that moves a letter to the end of a word, you can follow these steps:
1. Accept user input for the word and the letter to be moved. 2. Check if the word is at least 8 characters long. If not, prompt the user to enter a word with a minimum length of 8 characters. 3. Check if the letter to be moved is present in the word. If not, prompt the user to enter a valid letter. 4. If the word and letter are valid, perform the following operations: - Find the index of the letter in the word. - Remove the letter from its original position. - Append the letter to the end of the word. 5. Print the modified word.
Here's an example implementation in Python:
```python word = input("Enter a word (minimum 8 characters): ") letter = input("Enter a letter to move to the end: ")
if len(word) < 8: print("Word should be at least 8 characters long.") elif letter not in word: print("Letter is not present in the word.") else: index = word.index(letter) modified_word = word[:index] + word[index+1:] + letter print("Modified word:", modified_word) ```
Please note that this is just one way to implement the program. There are multiple approaches to achieve the desired result.
Example Usage: ``` Enter a word (minimum 8 characters): programming Enter a letter to move to the end: m Modified word: prograignmg ```
I hope this helps! Let me know if you have any further questions.


Топ вопросов за вчера в категории Информатика








Последние заданные вопросы в категории Информатика
-
Математика
-
Литература
-
Алгебра
-
Русский язык
-
Геометрия
-
Английский язык
-
Химия
-
Физика
-
Биология
-
Другие предметы
-
История
-
Обществознание
-
Окружающий мир
-
География
-
Українська мова
-
Информатика
-
Українська література
-
Қазақ тiлi
-
Экономика
-
Музыка
-
Право
-
Беларуская мова
-
Французский язык
-
Немецкий язык
-
МХК
-
ОБЖ
-
Психология
-
Физкультура и спорт
-
Астрономия
-
Кыргыз тили
-
Оʻzbek tili