SUJAY KUMAR
Student
Student
is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.
CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.
Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.
Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.
//Declare rows columns and arrays
- SUJAY KUMAR September 24, 2013int r,c;
int arr[50][50];
int i, j;
//Get no of rows
printf("Enter rows and column: ");
scanf("%d %d", &r, &c);
//Get elements of array
for(i=0;i<r;i++){
for(j=0; j<c; j++){
scanf("%d",&arr[i][j]);
}
}
//initialise sum of both the diagonals to zero so that we can pile up the data in it
int sum1=0, sum2=0;
for(i=0; i<r; i++){ //loop for rows 0 to (no_of_rows -1 )
for(j=0; j<c; j++){ //loop for column 0 to (no_of_columns -1 )
if(j==i && j==c-i-1) {sum1+=arr[i][j];break;} // both first and second diagonal intersect..
//only sum of first diag be incremented
if(j==i) sum1+=arr[i][j]; //if column is equal to row i.e. first diagonal
if(j==(c-i-1)) sum2+=arr[i][j]; //if column is equal to no_of_column-1-row i.e. second diagonal
}
}
//print out the sum
printf(" %d %d", sum1, sum2);