The first element in an array is index 0 not 1. Since you are using 1 as an index I suspect that you are printing: "2+5=7".
So, change a[1] and b[1] to a[0] and b[0]. [email protected] wrote: > #include<stdio.h> > int main() > { > int a[]={1,2,3}; > int b[]={4,5,6,7}; > sum=a[1]+b[1]; > printf("%d+%d=%d\n",a[1],b[1],sum); > return 0; > } > > I want to get the result "1+4=5".How to correct the programming? > Waiting for your reply > Thank you very much! > > __________________________________________________________ > $(AQE;"SJOd#,VUIz;o0i#!(T > [ http://mail.yahoo.com.cn/ ]http://mail.yahoo.com.cn/ > > [Non-text portions of this message have been removed] > > > > > > >
