Saved Bookmarks
| 1. |
Write a user-defined function AddEnd4(int A[][4],int R,int C) in C++ to find and display the sum of all the values, which are ending with 4 (i.e., unit place is 4).For example if the content of array is:2416141954The output should be42 |
|
Answer» void AddEnd4(int A[ ][4], int R, int C) { int I,J,sum=0; for(I=0;I<R;I++) { for(J=0;J<C;J++) if(A[I][J]%10 ==4) sum=sum+A[I][J]; } cout<<sum; } |
|