Sum of number divisible by 7 between 100 and 200
#include <iostream>
using namespace std;
int main()
{
int i, count = 0, sum = 0;
for (i=101; i<200; i++)
{
if(i%7 == 0)
{
count = count++;
sum = sum + i;
}
}
cout << "\n Total no of integer div by 7 is: " << count << endl;
cout << "\n sum of these number: " << sum << endl;
return 0;
}
OUTPUT:
No comments:
Post a Comment