MENU
Question -

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

22 16 12
19 5 2
The output should be 36



Answer -

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

Comment(S)

Show all Coment

Leave a Comment

×