Latest Post

 





#include <iostream>
#include <string>
using namespace std;
int main (){

// decision making

int n1, n2;
char op;

cout<< "Enter your 2 number" <<endl;
cin>>n1 >>n2;
cout<<"Enter your operand"<<endl;
cin>>op;

switch (op)
{
case '+':
cout<<n1+n2<<endl;
break;
case '-':
cout<<n1-n2<<endl;
break;

case '*':
cout<<n1*n2<<endl;
break;

case '/':
cout<<n1/n2<<endl;
break;

case '%':
cout<<n1%n2<<endl;
break;


default:cout<<"not valid"<<endl;
break;
}



return 0;
}



code for pattern      aaaaaaaaa

                               bbbbbbbb

#include <iostream>
using namespace std;
int main()
{

    for (char i = 'a'; i <= 'z'; i++)
    {
        for (char j = 'a'; j <= 'z'; j++)
        {
            cout << i;
        }
        cout << endl;
    }

    return 0;

} 

 



code for abcde_______________z






#include <iostream>
using namespace std;
int main()
{

    for (char i = 'a'; i <= 'z'; i++)
    {
        for (char j = 'a'; j <= 'z'; j++)
        {
            cout << j;
        }
        cout << endl;
    }

    return 0;
}

 


Code to Dram Hollow rectangular 

#include <iostream>
using namespace std;
int main()
{

    int n;
    cin >> n;
    for (int i = 1; i <= n; i++)
    {
        for (int j = 1; j <= n; j++)
        {
            if (i == 1 || i == n || j == 1 || j == n)
            {
                cout << "*";
            }
            else
                cout << " ";
        }
        cout << endl;
    }

    return 0;
}

Author Name

Contact Form

Name

Email *

Message *

Powered by Blogger.