Nov 5, 2021 at 9:54am
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 Nov 5, 2021 at 9:55am
Nov 5, 2021 at 10:23am
and the c++ question is? What have you attempted so far? Post you current code.
Nov 5, 2021 at 10:28am
Yes C++
#include<iostream>
using namespace std;
int main()
{
int sum = 0, n = 0;
int number[5];
.//dont know furthur
Nov 5, 2021 at 11:25am
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?