I dont really know where to start on this problem. Can anyone help me with it? L
ID: 3546462 • Letter: I
Question
I dont really know where to start on this problem. Can anyone help me with it?
Let (m,n) be a point on the 2-dimensional grid, where m and n are non-negative integers. Define function f(m,n) that has two input variables m,n of non-negative integers and outputs the number of different shortest paths on the grid from point (m,n) to point (0,0) by (a) specifying the function values at the Basis Step for some pairs of integers (m,n), and (b) giving a recursive rule for specifying the function values at other pairs of non-negative integers (Hint: f(1,1)=2).Explanation / Answer
#include <stdio.h> int main() { int m, n, c, d, first[10][10], second[10][10], sum[10][10]; printf("Enter the number of rows and columns of matrix "); scanf("%d%d", &m, &n); printf("Enter the elements of first matrix "); for ( c = 0 ; c < m ; c++ ) for ( d = 0 ; d < n ; d++ ) scanf("%d", &first[c][d]); printf("Enter the elements of second matrix "); for ( c = 0 ; c < m ; c++ ) for ( d = 0 ; d < n ; d++ ) scanf("%d", &second[c][d]); for ( c = 0 ; c < m ; c++ ) for ( d = 0 ; d < n ; d++ ) sum[c][d] = first[c][d] + second[c][d]; printf("Sum of entered matrices:- "); for ( c = 0 ; c < m ; c++ ) { for ( d = 0 ; d < n ; d++ ) printf("%d ", sum[c][d]); printf(" "); } return 0; }
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.