How to display the product of numbers divisible by 4 from 4 to 50 using do while loop
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
Comments
Leave a comment