Print even numbers in c++ || using class

Print even numbers in c++: Even numbers are the numbers which are divisible by 2 that type number is known as Even numberRemember this 2 point for(i=0;i<n;i++)if(i%2==0) Program: #include<iostream>using namespace std;class even{int n, i;public:void read();void print();};void even::read(){cout<< “enter the number you want to print even number”;cin>>n;cout<<“even number of size”<<n<<“isn”;}void even::print(){for(i=0;i<n;i++)if(i%2==0)cout<<i<<“n”;}int main(){even ob1;ob1.read();ob1.print();} Output: Click  Here … Read morePrint even numbers in c++ || using class

addition of two numbers in c++ | Using Class

addition of two numbers in c++, Using Class: #include<iostream>using namespace std;class addition{int a,b,sum;public:void read(); // Read given datavoid calculate(); // Calculate the 2 numbersvoid print(); // print the number that have been clalculated}; void addition::read(){cout<<“enter the two numbersn”;cin>>a>>b;} void addition::calculate(){sum=a+b;} void addition::print(){cout<<“sum oft”<<a<<” andt “<<b<<“tist”<<sum;} int main(){addition ob1;ob1.read();ob1.calculate();ob1.print();} Output: Click below Link For Download Executable … Read moreaddition of two numbers in c++ | Using Class