Please Help My HW

Take input positive and negative both numbers from the user and Write a program to find the sum of only positive numbers using while loop.
Last edited on
and the c++ question is? What have you attempted so far? Post you current code.
Yes C++
#include<iostream>
using namespace std;
int main()
{
int sum = 0, n = 0;
int number[5];
.//dont know furthur
Do you know how to obtain a number from the user using cin >> ?

Do you know how to use a while loop?

Do you know how to determine if a number is positive?

Start small. Just get a number and determine if it is positive using an if statement.

Once you have that, then introduce a loop. What is the terminating condition for the loop?
Topic archived. No new replies allowed.