Есть ответ 👍

Создайте 5 переменных типа char, предложите пользователю ввести слово из пяти букв и покажите эти символы (слово) на экран. (символы вводить латиницей, т.к. кирилица будет отображаться некорректно.

266
359
Посмотреть ответы 3

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


1) на c++ #include < iostream> using namespace std; int main() { char a=0,b=0,c=0,d=0,e=0; cout< < "enter the word which have 5 letters: "< < endl; cin> > a> > b> > c> > d> > e; cout< < "you word: "< < a< < b< < c< < d< < e< < endl; return 0; } 2) на pascalabc.net program n1; var a,b,c,d,e: char; begin write('enter the word which have 5 letters: '); readln(a,b,c,d,e); write('you word: ',a,b,c,d,e); end.
vanzoca
4,4(19 оценок)

// pascalabc.net 3.3, сборка 1600 от 23.12.2017 // внимание! если программа не работает, обновите версию! begin   var a: =readlnchar('введите 1-й символ и нажмите enter: ');   var b: =readlnchar('введите 2-й символ и нажмите enter: ');   var c: =readlnchar('введите 3-й символ и нажмите enter: ');   var d: =readlnchar('введите 4-й символ и нажмите enter: ');   var e: =readlnchar('введите 5-й символ и нажмите enter: ');   writeln(a,b,c,d,e) end.

Данная программа находит именно сумму между элементами в массиве:

using System;

class main{

 static void Main() {

     Console.Write("Введите кол-во элементов в массиве: ");

     int N = Convert.ToInt32(Console.ReadLine());

     

     int[] myArr = new int[N];

     for (int i = 0; i < N; i++)

     {

         Console.Write("Введите элемент: ");

         myArr[i] = Convert.ToInt32(Console.ReadLine());

     }

     

     Console.Write("Введите начало отрезка: ");

     int a = Convert.ToInt32(Console.ReadLine());

     Console.Write("Введите конец отрезка: ");

     int b = Convert.ToInt32(Console.ReadLine());

     

     int[] list = new int[N];

     bool flag = false;

     

     for (int i = 0; i < myArr.Length; i++)

     {

         if (a == myArr[i]) {

             flag = true;

         }

         if (flag == true) {

             list[i] = (myArr[i]);

             if (b == myArr[i]) break;

         }

     }

     

     int count = Convert.ToInt32(0);

     for (int i = 0; i < list.Length; i++) {

         if (list[i] > 0) count += list[i];

         

     }

     Console.Write("Сумма: ");

     Console.Write(count);

 }

}

Эта программа находит сумму между индексами элементов в массиве в массиве (если считать от 1):

using System;

class main {

 static void Main() {

       Console.Write("Введите кол-во элементов в массиве: ");

       int N = Convert.ToInt32(Console.ReadLine());

       int[] myArr = new int[N];

       for (int i = 0; i < N; i++)

       {

           Console.Write("Введите элемент: ");

           myArr[i] = Convert.ToInt32(Console.ReadLine());

           

       }

     

       Console.Write("Введите начало отрезка: ");

       int a = Convert.ToInt32(Console.ReadLine());

       Console.Write("Введите конец отрезка: ");

       int b = Convert.ToInt32(Console.ReadLine());

       

       int[] list = new int[N];

       bool flag = false;

       

       for (int i = 0; i < myArr.Length; i++)

       {

           if (a == i + 1) {

               flag = true;    

           }

           if (flag == true) {

               list[i] = myArr[i];

               if (b == i + 1) break;

           }

           

       }

       int count = 0;

       for (int i = 0; i < list.Length; i++) {

           if (list[i] > 0) count += list[i];

       }

       Console.Write("Сумма: ");

       Console.Write(count);

 }

}

Популярно: Информатика