Novak_Djokovic Posted April 29, 2014 Author Report Posted April 29, 2014 yaaa kani honest suggestion inka dikku lekapothey vellu HCL vaditho ..... HCL kaadu bro...HP... anni desi companies almost same... Thanks.
Novak_Djokovic Posted April 29, 2014 Author Report Posted April 29, 2014 int a[] = { -3, 100, -4, -2, 9, -63, -200, 55 };int max_sum, temp_sum, i, n = 8, t;temp_sum = max_sum = a[0];for (i = 0; i < n; i++) {if (a[i] > 0)temp_sum += a[i];else {t = 0;while (a[i] < 0 && i < n) {t += a[i];i++;}if (temp_sum + t > 0) {temp_sum = temp_sum + t + a[i];if (temp_sum > max_sum)max_sum = temp_sum;} else if (i < n)temp_sum = a[i];}}if (temp_sum > max_sum)max_sum = temp_sum;printf("Maximum Numbers is %d \n", max_sum); VB.Net code kaavli... C# kaadhu... Thanks for ur interest.
ChampakDas Posted April 29, 2014 Report Posted April 29, 2014 you are right Maximum and second maximum numbers of the array telsina saripodhu kada bhayya... two consecutive integers with largest sum annadu kada... array lo -9 8 -6 -4 7 -5 3 2 unnayi anuko....max second max teslisthe saripodhu kadha...
Recommended Posts