A)
#include <iostream>
#include <cstdlib>
using namespace std;
int main()
{
int ch;
int a, b;
float res;
cout<<"Enter two numbers : ";
cin>>a>>b;
cout<<"\nEnter operation you want to perform : "<<endl;
cout<<"\t1. Addition..."<<endl;
cout<<"\t2. Subtraction..."<<endl;
cout<<"\t3. Multiplication..."<<endl;
cout<<"\t4. Division..."<<endl;
cout<<"\t5. Exit..."<<endl;
cout<<"Enter your choice!!!"<<endl;
cin>>ch;
switch(ch)
{
case 1: res = a+b;
break;
case 2: res = a-b;
break;
case 3: res = a*b;
break;
case 4: res = (float)a/b;
break;
case 5: cout<<"Thanks for stopping by!!!";
exit(0);
}
cout<<"\n\nResult is :"<<res<<" !!!"<<endl;
return 0;
}
B)
#include <iostream>
#include <cstdlib>
using namespace std;
int main()
{
int i, j;
for(i=9;i>=0;i--)
{
for(j=0;j<=i;j++)
{
cout<<j;
}
cout<<endl;
}
return 0;
}
Cheers