How to multiply two arrays and store the digits in array c++ gfg
Answers
Answered by
0
Input : array[] = {1, 2, 3, 4, 5, 6}
Output : 720
Here, product of elements = 1*2*3*4*5*6 = 720
Input : array[] = {1, 3, 5, 7, 9}
Output : 945
Hope helps
Answered by
1
Answer:
#include<iostream.h>
#include<conio.h>
void input1(int a[],int n)
{
cout<<"\nEnter elements of first array ";
for(int i=0;i<n;i++)
cin>>a[i];
}
void input2(int b[i],int n)
{
cout<<"\nEnter elements of second array ";
for(int i=0;i<n;i++)
cin>>a[i];
}
void multiply(int a[],int b[],int n)
{
for(int i=0;i<n;i++)
cout<<a[i]*b[i]<<endl;
}
void main()
{
clrscr();
int a[100],b[100],n;
cout<<"\n Enter size of array";
cin>>n;
input1(a,n);
input2(b,n);
multiply(a,b,n);
getch();
}
Similar questions