Little bit confuse on how can I turn this if else statement to a do while statement.
Need some help..
#include<iostream>
using namespace std;
int main()
{
int div1,div2,rem,num;
int count1=0,count2=0,sum1=0,sum2=0;
system("cls");
cout<<"Enter divisors : ";
cin>>div1>>div2;
cout<<"Enter remainder to search : ";
cin>>rem;
cout<<"Enter number 1 : ";
cin>>num;
if (num % div1==rem || num % div2== rem)
{
count1+=1;
sum1+=num;
}
else
{
count2+=1;
sum2+=num;
}
cout<<"Enter number 2 : ";
cin>>num;
if (num % div1==rem || num % div2== rem)
{
count1+=1;
sum1+=num;
}
else
{
count2+=1;
sum2+=num;
}
cout<<"Enter number 3 : ";
cin>>num;
if (num % div1==rem || num % div2== rem)
{
count1+=1;
sum1+=num;
}
else
{
count2+=1;
sum2+=num;
}
cout<<"Enter number 4 : ";
cin>>num;
if (num % div1==rem || num % div2== rem)
{
count1+=1;
sum1+=num;
}
else
{
count2+=1;
sum2+=num;
}
cout<<"Enter number 5 : ";
cin>>num;
if (num % div1==rem || num % div2== rem)
{
count1+=1;
sum1+=num;
}
else
{
count2+=1;
sum2+=num;
}
cout<<"Count of numbers which one/all remainder is equal to "<<rem<<" : "<<count1<<endl;
cout<<"Sum of numbers which one/all remainder is equal to "<<rem<<" : "<<sum1<<endl;
cout<<"Count of numbers which all remainder is not equal to "<<rem<<" : "<<count2<<endl;
cout<<"Sum of numbers which all remainder is not equal to "<<rem<<" : "<<sum2<<endl;
system("pause");
return 0;
}
Need some help..