Answer to Question #251519 in C++ for lili

Question #251519

How to display the product of numbers divisible by 4 from 4 to 50 using do while loop


1
Expert's answer
2021-10-15T01:27:52-0400

Source code

#include <iostream>


using namespace std;


int main()
{
    long long product=1;
    int i=4;
    cout<<"Numbers divisible by four between 4 and 50 are: \n";
    do{
        if(i%4==0){
            product*=i;
            cout<<i<<"\t";
        }
        i++;
    }
    while(i<=50);
    
    cout<<"\nThe product of numbers divisible by 4 between 4 and 50 is: "<<product;


    return 0;
}


Output





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
APPROVED BY CLIENTS