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: 24 16 14 19 5 4 The output should be 42
Answers
Answered by
0
Answer:
there is lot of difference b/w function and fiction
Answered by
0
Program:
This program is based on array.
The meaning of the variables is given below:
- The variable "J" in below program defines column subscript of element whose address is to be found.
- The variable "I" defines row subscript of element whose address is to be found.
- The variable "C" defines number of column of the given matrix.
- The variable "R" defines number of row of the given matrix.
- A[ ][ ] defines the array with rows and columsn.
C++ Program:
#include <iostream.h>
void AddEnd4(int A[ ][4], int R, int C)
{
int I,J,sum=0;
for(|=0 ;I<R ; I++)
{
for(J=0;J<C;J++)
if(A[I][J]%10 ==4)
sum=sum+A[I][J];
}
cout<<sum;
}
Similar questions
English,
5 months ago
Hindi,
5 months ago
Accountancy,
11 months ago
Biology,
1 year ago
Math,
1 year ago