Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

Compile and Execute C Online

#include <stdio.h>
#include <stdlib.h>

#define N 100
int computeSum(int* input, int M);

/* write a program to compute a running average of the signal */
int main()
{
    printf("Hello, World!\n");
    
    int i,j;
    int input[N];
    int output[N];
    for (i=0;i<N;i++){
        input[i] = (rand()%100);
        output[i] = 0;
    }
    
    for (j=0;j<N-10;j++)
        output[j] = computeSum(&input[j], 10);

    for (i=0;i<N;i++){
        printf(" In %d Output %d\n",input[i],output[i]);
    }
    return 0;
}



int computeSum(int* input, int M){
    int i,sum = 0;
    for (i=0;i<M;i++){
        sum += input[i];
    }
    sum = sum/M;
}

Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.