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

28th Jun 2022, 2:39 AM
jaseer j
jaseer j - avatar
5 Answers
+ 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.
28th Jun 2022, 3:00 AM
Chris Coder
Chris Coder - avatar
+ 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
28th Jun 2022, 4:33 AM
Aly Alsayed
Aly Alsayed - avatar
+ 1
jaseer j Your attempts?
28th Jun 2022, 2:56 AM
A͢J
A͢J - avatar
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; }
10th Nov 2022, 10:27 AM
Prajosh Johny
Prajosh Johny - avatar
0
program to multiply the adjacent values of an array and store it in an another array
12th Jun 2023, 9:33 AM
Anantha Krishnan
Anantha Krishnan - avatar