**Write a program to find the number and sum of all integer between 100 and 200 which are divisible by 9 using the classes.**

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
//Write a program to find the number and sum of all integer between 100 and 200 which are divisible by 9. #include<iostream> using namespace std; class number { private: int i,sum=0; public: int show_num() { for(i=101; 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() { number f; f.show_num(); } |

**WAP to find the number and sum of all integer between 100 and 200 which are divisible by 9 using the single inheritance.**

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
//Write a program to find the number and sum of all integer between 100 and 200 which are divisible by 9. //single inheritence #include<iostream> using namespace std; class number { protected: int i,sum=0; }; class child:public number { public: int show_num() { for(i=101; 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() { child f; f.show_num(); } |

**WAP to show the sum of all integer between 100 and 200 which are divisible by 9 with the help of multiple inheritances.**

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
//Write a program to find the number and sum of all integer between 100 and 200 which are divisible by 9. //multiple inheritence #include<iostream> using namespace std; class number { protected: int i; }; class number2 { protected: int sum=0; }; class child:public number,public number2 { public: int show_num() { for(i=101; 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() { child f; f.show_num(); } |

**WAP to show the sum of all integer between 100 and 200 which are divisible by 9 with the help of multi-level inheritance.**

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
//multi level inheritence #include<iostream> using namespace std; class number { protected: int i; }; class number2:public number { protected: int sum=0; }; class child:public number2 { public: int show_num() { for(i=101; 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() { child f; f.show_num(); } |

Latest posts by Prof. Fazal Rehman Shamil (see all)

- How Students Can Pick a Good Custom-Paper Writing Service? - March 5, 2021
- List of Public service commissions - August 31, 2020
- Comparison of fee structure of Pakistani Universities - June 1, 2020