Answer:
Following are the code in C language
#include <stdio.h> // header file
int main() // main function
{
int s1=0;// variable declaration
int arr[10]={4,6,9,12}; // array declaration
for(int k=0;k<4;++k) // iterating over the loop
{
s1=s1+arr[k]; // sum of the array of elements
}
for(int k=0;k<4;++k) // iterating over the loop
{
if(k<3)
{
printf("%d+",arr[k]); //for display values
}
else
{
printf("%d=",arr[k]);
}
}
printf("%d",s1); // display the total sum
return 0;
}
Output:
4+6+9+12=31
Explanation: