Answer:
The program in C is as follows:
#include <stdio.h>
int main(){
char data[50];
int ad [8];
int i;
for (i = 0; i < 8; i++) { scanf("%d", &ad[i]); }
int j = 0;
for (i = 7; i >= 0; i--) {
sprintf(&data[j], "%d", ad[i]);
j++;
}
printf("%s",data);
return 0;
}
Step-by-step explanation:
This declares data as a string
char data[50];
This declares ad as an integer array
int ad [8];
This declares i as a counter variable
int i;
This iterates from 0 to 7 to get input for each element of integer array ad
for (i = 0; i < 8; i++) { scanf("%d", &ad[i]); }
This declares and initializes j to 0, as a counter variable
int j = 0;
This iterates through array ad, backwards and appends each element to variable data
for (i = 7; i >= 0; i--) {
sprintf(&data[j], "%d", ad[i]);
j++; }
This prints data
printf("%s",data);