0
Problem in C
Enter an array of max 100 elements (two-digit integers). The N value that determines the size of the array is read from the keyboard. Write a C program to reverse the element numbers of the input array, forming a new array according to the following example: original array: 25 71 84 ..., new array: 52 17 48...
10 Antworten
+ 3
Thanks very much)),it works
+ 1
Elvian Covalciuc please attempt the code, if have any doubt or get an error we try to solve it.
+ 1
#include <stdio.h>
int main()
{
int a[100],n,i,nr1,nr2,result;
int b[100];
printf(" enter the array size:\n");
scanf("%d",&n);
for(i=0;i<n;i++)
{
printf("a[%i]=",i);
scanf("%d",&a[i]);
}
for(i=0;i<n;i++){
nr1 = a[i] % 10;
nr2 = a[i] /10;
b[i] = 10 * nr1 + nr2;
}
for(i=0;i<n;i++)
printf("b[%i]=\n",i);
return 0;
}
+ 1
here works the size of the Matrix, but I'm not sure that it changes the numbers with the correct place and does not display them
+ 1
But array 2 didn't work
+ 1
Elvian Covalciuc ,
why do you think it doesn't work?
+ 1
I check it again,program works, sorry
+ 1
And thanks
+ 1
I fixed the print format i replaced %d with the %02d
Because to display the opposite of 30 as 03 and not 3