• Написать программу в СИ, которая переворачивает массив. (Пример: 12345 ⇒ 54321)

Ответы 1

  • #include "stdio.h"

    #include "stdlib.h"

    int main(){

    int amount = 0;

    int mas[amount];

    int temp;

    printf("Input capacity of massiv: "); scanf("%d",&amount);

    for(int i = 0 ; i < amount; ++i){

     printf("Element [%d] = ",i+1); scanf("%d",&mas[i]);

    }

    for(int i = 0; i < amount/2; ++i){

     temp = mas[amount-i-1];

     mas[amount-i-1] = mas[i];

     mas[i] = temp;

    }

    for(int i = 0; i < amount; ++i){

     printf("%d ", mas[i]);

    }

    system("pause");

    return 0;

    }

  • Добавить свой ответ

Войти через Google

или

Забыли пароль?

У меня нет аккаунта, я хочу Зарегистрироваться

How much to ban the user?
1 hour 1 day 100 years