MENU
Question -

Write a user-defined function SumLast 3 (int A [] [4], int N, int M) in C + + to find and display the sum of all the values, which are ending with 3 (i.e., units place is 3). Fdr example if the content of array is :

33 13 92
99 3 12
The output should be 49



Answer -

void SumLast 3 (int A[] [4], int N, int M)
 {
 int Sum=0;
 for(int i=0; i
 for(int j = 0; j
 {
 If (((A[i] [j]-3)% 10==0))
 Sum=Sum+A[i][j];
 }
 cout<
 }

Comment(S)

Show all Coment

Leave a Comment

×