Create a function that receives array as an argument, and displays the two dimen
ID: 652906 • Letter: C
Question
Create a function that receives array as an argument, and displays the two dimensional array. Create a function that receives arrays as arguments, and transforms the input array. (See the example for how you need to transform) Create a main function that initialize an array and invoke functions.
Section 1: Create a function that receives an array as an argument, and displays the two dimensional array. (Displaying function) Section 2: Create a function that receives two arrays as arguments, and transforms the first array and store the result into the second array.(Transforming function) Section 3: Main function. Set a random number seed to 1 followed by the last 3 digits of your student ID. Declare two arrays, both 5 X 5 array.Populate the first array with random numbers that are 2 digits long (10 through 99).Section 4: invoke the Display function by passing the first array as argument. Section 5: Invoke the Transforming function by passing two arrays as arguments. Section 6: Invoke the Display function by passing the resulting array as argument.
sample output:
https://onedrive.live.com/redir?resid=3274BC86E4F10732!1692&authkey=!APHgrVI2MiPVzPw&v=3&ithint=photo%2cjpg
Explanation / Answer
#include<stdio.h>
#include<conio.h>
void doit(int a[5][5], int b[5][5])
{
int i,j,p=4,k=4;
for(i=0;i<5;i++)
{
for(j=0;j<5;j++)
{
b[i][j]=a[p][k];
k--;
}
p--;
}
printf(" Result is ");
for(i=0;i<5;i++)
{
for(j=0;j<5;j++)
{
printf("%d ",b[i][j]);
}
printf(" ");
}
getch();
}
void main()
{
int a[5][5],b[5][5],i,j;
clrscr();
printf(" Enter 5 no");
for(i=0;i<5;i++)
{
for(j=0;j<5;j++)
{
scanf("%d",&a[i][j]);
}
}
doit(a,b);
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.