fork download
  1. #include <stdio.h>
  2. int main(){
  3. int a[5],b[5];
  4. a[]={2,3,4,5,6};
  5.  
  6. for(int i=1;i<=4;i++)
  7. {
  8. b[i]=a[i-1]*a[i+1];
  9. }
  10. b[0]=a[0]*a[1];
  11. b[4]=a[4]*a[3];
  12. for(int j=0;j<5;j++){
  13. printf("%d",b[i]);
  14. }
  15. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.c: In function ‘main’:
prog.c:4:7: error: expected expression before ‘]’ token
     a[]={2,3,4,5,6};
       ^
prog.c:13:23: error: ‘i’ undeclared (first use in this function)
         printf("%d",b[i]);
                       ^
prog.c:13:23: note: each undeclared identifier is reported only once for each function it appears in
prog.c:3:14: warning: variable ‘b’ set but not used [-Wunused-but-set-variable]
     int a[5],b[5];
              ^
stdout
Standard output is empty