Write a program in C++ to find the number and sum of all integer between 100 and 200 which are divisible by 9.
//Write a program to find the number and sum of all integer between 100 and 200 which are divisible by 9.
//virtual class
#include<iostream>
using namespace std;
class number
{
public:
int i;
};
class number2:public virtual number
{
public:
int sum;
};
class number3:public virtual number
{
public:
int n;
};
class final:public number2 , public number3
{
public:
int show_num()
{
cout<<"enter a first number of your loop to start loop :"<<endl;
cin>>n;
sum=0;
for(i=n; i<200; i++)
if(i%9==0)
{
cout<<"numbers divisble by 9 is= "<<i<<endl;
sum=sum+i;
}
cout<<"sum of all numbers divisible by 9 is= "<<sum<<endl;
}
};
int main()
{
final d;
d.show_num();
}