0
Write a program to multiply the adjacent values of an array and store it in an another array in c language
Eg: Enter the array limit 5 Enter the values of array 1 2 3 4 5 Output 2 6 12 20
5 odpowiedzi
+ 3
Hi jaseer j we ask that members provide their attempts because this is a learning platform. Providing an attempt can show where you may need improvements. Then we can better assist you in clearing your doubt.
+ 2
jaseer j
steps for solution
1.get first input n and that is the number of elements of array
2.the new array will have number of elements n-1
3.loop to get the elements of first array
4.loop again to fill the new array
new[i]= old[i]*old[i+1]
5. print the new array
I hope this will help u
+ 1
jaseer j
Your attempts?
0
#include <stdio.h>
#include <stdlib.h>
int main(void) {
int n,i,a[10],b[10];
setbuf(stdout,NULL); ///for the eclipse//
printf("Enter the limit of the array");
scanf("%d",&n);
printf("Enter the array elemnts :\n");
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
printf("result :");
for(i=0;i<n-1;i++)
{
b[i]=a[i]*a[i+1];
printf("%d \t",b[i]);
}
return EXIT_SUCCESS;
}
0
program to multiply the adjacent values of an array and store it in an another array