Skip to content

Instantly share code, notes, and snippets.

@gallirohik
Created February 25, 2018 18:52
Show Gist options
  • Save gallirohik/bbb917b62662232f73d49f19c009a6d9 to your computer and use it in GitHub Desktop.
Save gallirohik/bbb917b62662232f73d49f19c009a6d9 to your computer and use it in GitHub Desktop.
get Maximum sum
#include <stdio.h>
#include <stdlib.h>
int main()
{
int arr[50],i,n,sum=0;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&arr[i]);
if(arr[i]>0)
sum+=arr[i];
}
printf("sum is:%d",sum);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment