[ create a new paste ] login | about

Link: http://codepad.org/vizAoUkd    [ raw code | output | fork ]

C, pasted on Feb 14:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include <stdio.h>
int main(){
    float arr[3] = {40, 80, 60};
    float m = 0;
    int i;
    float sum = 0;

    for(i = 0; i < n; i++)
        m = arr[i] > m ? arr[i] : m;

    for(i = 0; i < n; i++){
        arr[i] = arr[i]/ m * 100;
        sum += arr[i];
    }
    printf("%.2f", sum / n);
    return 0;
}


Output:
1
2
3
4
In function 'main':
Line 8: error: 'n' undeclared (first use in this function)
Line 8: error: (Each undeclared identifier is reported only once
Line 8: error: for each function it appears in.)


Create a new paste based on this one


Comments: