Answer to Question #281100 in C++ for lily

Question #281100

4. The Positive Ones

by CodeChum Admin

There are different kinds of numbers, but among them all, the most commonly used numbers in our daily lives are those positive ones. So, I only want you to count all the positive numbers from the 4 outputted values and print out the result.


Go and search for the positive ones among these four!


1
Expert's answer
2021-12-20T09:55:07-0500
#include <iostream>
using namespace std;


int main()
{
    int a,b,c,d;
    
    cout<<"Enter a Number: ";
    cin>>a;
    
    cout<<"Enter a Number: ";
    cin>>b;
    
    cout<<"Enter a Number: ";
    cin>>c;
    
    cout<<"Enter a Number: ";
    cin>>d;
    
    if (a > 0)
    {
        cout<<a<<endl;
    }
    
    if (b > 0)
    {
        cout<<b<<endl;
    }
    
    if (c > 0)
    {
        cout<<c<<endl;
    }
    
    if (d > 0)
    {
        cout<<d<<endl;
    }
    
    
    
    
    
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog