fork download
  1. #include<stdio.h>
  2. int main()
  3. {
  4. int i,a[]={2,3,4,5,6},b[5];
  5. for(i=0;i<5;i++)
  6. {
  7. if(i==0)
  8. b[i]=a[i]*a[i+1];
  9. else if(i==4)
  10. b[i]=a[i]*a[i-1];
  11. else
  12. b[i]=a[i-1]*a[i+1];
  13. }
  14. for(i=0;i<5;i++)
  15. printf("%d ",b[i]);
  16. }
Success #stdin #stdout 0s 4336KB
stdin
Standard input is empty
stdout
6 8 15 24 30