//sum of two 5 bit binary int ar1[ 5 ]; int ar2[5]; int ar3[6]; int i; for ( i=0; i<5; i++) cin>>ar[i]; for ( i=0; i <5; i++) cin>>ar1[i]; { ar2[i] = ar[i] + ar1[i] + ar3[i]; if ( ar2[i] > 1) { ar3[i+1] = 1; ar2[i] %= 2; } cout<<ar2[i]<<endl;} return 0;
for(int i=0; i<5;i++) x=i;
for(int i=0; i<5;i++) { //<-- More than one statement, must include brackets to keep it inside of statement x=i; y= x+5; //etc... }
ar[]
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)