2 Find the sum of all the positive numbers
entered by the user.
As soon as the user enters a negative number,
stop taking in any
further input from the user and display the
sum
Answers
Answered by
1
Answer:
H quotes app sit discussion today's clockwork social studies social clock jjco Manish
Answered by
1
Answer:
What language do you want it in
Explanation:
I did it in C
The code :
#include<stdio.h>
int main()
{
int x,y,num,sum=0;
printf("Enter number of numbers to calculate:");
scanf("%d",&x);
y=0;
printf("Enter %d numbers to sum:",x);
while(y<x)
{
scanf("%d",&num);
if(num>=0)
{
sum=sum+num;
}
y++;
}
printf("The Sum is: %d",sum);
return 0;
}
Similar questions