C program to read hundred integers and find the sum of only positive integers and skip negative integer
#include<stdio.h>
int main()
{
int a[100],i,sum=0;
for(i=0;i<=99;i++)
{
if(a[i]>0)
sum=sum+i;
}
printf("sum of positive integers=%d",sum);
return 0;
}
No comments:
Post a Comment