hi everyone
this is the code i dont understand and the output is 24.... so can someone show me working and example of the process..thank you
Code:#include <iostream> #include <cstdlib> using namespace std; int main() { const int MAX = 6; int arr[MAX]; int count; int temp; for(count = 0; count<MAX; count++) arr[count] = count+1; for(count = 0; count<(MAX/2); count++) { temp = arr[count]; arr[count] = arr[MAX - (count + 1)]; arr[MAX - (count + 1)] = temp; } for(count = 0; count<MAX ; count++) temp = temp + arr[count]; cout<<temp<<" "; system("pause"); return 0; }//end main



LinkBack URL
About LinkBacks


