Write a C++ program to find the number and sum of all integer between 100 and 200 which are divisible by 9 with inline function.

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 T4Tutorials_Sum of all integer between 100 and 200 which are divisible by 9. //inline function #include<iostream> using namespace std; class number { private: int i,T4Tutorials_Sum=0; public: int in(); int show_num(); }; inline int number::in() { cout<<"numbers that are divisible by 9 between 100 and 200\n"; } inline int number::show_num() { for(i=101; i<200; i++) if(i%9==0) { cout<<"numbers divisble by 9 is= "<<i<<endl; T4Tutorials_Sum=T4Tutorials_Sum+i; } cout<<"T4Tutorials_Sum of all numbers divisible by 9 is= "<<T4Tutorials_Sum<<endl; } int main() { number f; f.in(); f.show_num(); } |