ArrayReverse

This commit is contained in:
2021-04-27 13:16:21 +05:30
parent 9efbd42b29
commit 5e37c1d12b
3 changed files with 26 additions and 1 deletions

24
ArrayReverse.c Normal file
View File

@@ -0,0 +1,24 @@
// WAP to print out an array of dynamic values in rverse order.
void main() {
int i, r, a[10], n;
// To set range of array:
printf("\n Enter the range of array: \n");
scanf("%d", &n);
// To get values of array:
printf("\n Enter the elements of the array: \n");
n-1;
r = n;
for (i=0 ; i<=n; i++) {
scanf("%d", &a[i]);
}
// To print the elements of the array:
printf("\n The elements of the array are: \n");
for (i=n ; i>=0; i--) {
r--;
printf("\n a[%d] = %d \n", r, a[i]);
}
}

BIN
ArrayReverse.exe Normal file

Binary file not shown.

View File

@@ -25,3 +25,4 @@
|23 | MultiplicationTable.c | MultiplicationTable.exe | WAP to print the multiplication table for a given number | |23 | MultiplicationTable.c | MultiplicationTable.exe | WAP to print the multiplication table for a given number |
|24 | Divisible.c | Divisible.exe | WAP to find an addition of numbers which are >30, <100 & divisible by 7 | |24 | Divisible.c | Divisible.exe | WAP to find an addition of numbers which are >30, <100 & divisible by 7 |
|25 | Array.c | Array.exe | WAP to print out an array of dynamic values | |25 | Array.c | Array.exe | WAP to print out an array of dynamic values |
|26 | ArrayReverse.c | ArrayReverse.exe | WAP to print out an array of dynamic values in reverse order |