Write a program to find sum of differences between adjacent numbers in a array of positive integers
Answers
Answered by
5
Answer:
class prog{
void main(int n)
{
int a[]=new int[n];
int k=0;
for(int i=1;i<n;i++)
{
k=k+(a[i]-a[i-1]);
}
System.out.println(k);
}}
Similar questions
Math,
6 months ago
Math,
6 months ago
Physics,
6 months ago
Computer Science,
11 months ago
Computer Science,
11 months ago
Chemistry,
1 year ago