Can someone help me code this in Visual Basic 2013 where I can get it right and
ID: 665579 • Letter: C
Question
Can someone help me code this in Visual Basic 2013 where I can get it right and get an output window.
1.
Write a program that reads a 5 x 5 two-dimensional array of integers and then prints the row sums and the column sums:
Enter row 1:
Enter row 2:
Enter row 3:
Enter row 4:
Enter row 5:
Row Totals:
Column Totals:
You may either initialize this array within the program or have the user type in the values at run time.
Thanks,
Need help bad
Enter row 1:
Enter row 2:
Enter row 3:
Enter row 4:
Enter row 5:
Explanation / Answer
main () {
int arr1[5][5],arr2[5][5],i,j,rowSum;
for(i=0;i<5;i++)
{
for(j=0;j<5;j++)
{
printf("Enter a number:");
scanf("%d",&arr1[i][j]);
}
}
//now accept the values for second array
for(i=0;i<5;i++)
{
for(j=0;j<5;j++)
{
printf("Enter a number:");
scanf("%d",&arr2[i][j]);
}
}
i=0;j=0;
for(i=0;i<5;i++)
{
rowSum=0;
for(j=0;j<5;j++)
{
rowSum+=arr1[i][j]+arr2[i][j];
}
printf("Sum of rows of both 1st and 2nd array is: %d",rowSum);
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.