We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
int main()
{
int a[150], temp , size, i;
printf("Enter the size of the array : ");
scanf("%d", &size);
for (i = 0; i < size; i++)
{
printf("Enter element number %d :", i + 1);
scanf("%d", &a[i]);
}
printf("your array elements are :");
for (i = 0; i < size; i++)
{
printf("%d", a[i]);
}
printf("\nreverse array : ");
for (i = 0; i < size/2; i++)
{
temp = a[i];
a[i] = a[size - i - 1];
a[size - i - 1] = temp;
}
for (i = 0; i < size; i++)
{
printf("%d", a[i]);
}
}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Arrays - DS
You are viewing a single comment's thread. Return to all comments →
please help me to correct the code
include
int main() { int a[150], temp , size, i; printf("Enter the size of the array : "); scanf("%d", &size); for (i = 0; i < size; i++) { printf("Enter element number %d :", i + 1); scanf("%d", &a[i]); } printf("your array elements are :"); for (i = 0; i < size; i++) { printf("%d", a[i]); }
}