Jump to content

.net Prog-Rammers- Help-...cheyandi....


Recommended Posts

Posted

yaaa kani honest suggestion inka dikku lekapothey vellu HCL vaditho .....

 

HCL kaadu bro...HP...

 

anni desi companies almost same...

 

Thanks.
 

Posted

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.

 

Posted

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...

 

×
×
  • Create New...