[ create a new paste ] login | about

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

C, pasted on Jul 17:
#include <stdio.h>
#include <stdlib.h>
#include "iostream"

int A[5], a,N;
A[]={2, -4, 6,-3,9};
N=5;
a=solucion(A,N);
cout<<a;
int solucion(int A[],int N){

int sumabs;
int min,i,j,p;
int p=0;
int suma=A[p];
min=100;
for(i=1;i<=N;i++){
for(j=p+1;j<=N;j++){
suma=suma+A[j];
sumabs=abs(suma);
    if(sumabs<min){min=sumabs;}


}
p=p+1;
suma=A[p];

}
return min;

}


Output:
1
2
3
4
5
6
7
8
9
Line 19: error: iostream: No such file or directory
Line 6: warning: data definition has no type or storage class
Line 7: warning: data definition has no type or storage class
Line 8: warning: data definition has no type or storage class
Line 8: error: initializer element is not constant
Line 9: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<<' token
In function 'solucion':
Line 14: error: redeclaration of 'p' with no linkage
Line 13: error: previous declaration of 'p' was here


Create a new paste based on this one


Comments: