You are on page 1of 5

HOME WORK O1

01.....
#include<iostream>
using namespace std;
void main()
{ int max,x,y,z,a,b;
cout<<"enter 5 numbers " <<endl;
cin>>x;
cin>>y;
cin>>z;
cin>>a;
cin>>b;
max=x;
if(y>max)
{y=max;}
if(z>max)
{max=z;}
if(a>max)
{max=a;}
if(b>max)
{max=b;}
cout<<"max :\t\t\t**"<<max<<"\n";
}

02....
#include <iostream>
using namespace std;
int main()
{
int i;
cout <<"N\t"<<"10*N\t"<<"100*N\t"<<"1000*N\t"<<endl;
for (i=1;i<11;i++)
cout<<i<<"\t"<<10*i<<"\t"<<100*i<<"\t"<<1000*i<<endl;
}

03....

04.#include <iostream>
using namespace std;
void main()
{ int count = 1;
while (++count<= 10 )
cout<<count++;
{
if ( count % 2 == 0 )
cout << "****";
else
cout << "++++++++";
} }

05....
(b)....
#include <iostream>
using namespace std;
int main()
{
int x,y;
cout << "enter the number =";
cin >>x>>y;
if ( x < 10 )
{
if ( y > 10 )
cout << "*****" << endl;
}
else
{
cout << "#####" << endl;
cout << "$$$$$" << endl;
}
}

(a).....
#include <iostream>
using namespace std;
int main()
{
int x,y;
cout << "enter the number =";
cin >>x>>y;
if ( x < 10 )
if ( y > 10 )
cout << "#####" << endl;
cout << "$$$$$" << endl;
}

06.....(a)
#include <iostream>
using namespace std;
int main()
{
int x,y;
cout << "enter numbers ";
cin >>x>>y;
if ( y == 8 )
if ( x == 5 )
cout << " @@@@@" << endl;
cout << "$$$$$" << endl;
cout << "&&&&&" << endl;
else
cout << "#####" << endl;
}

(b)...
#include <iostream>
using namespace std;
int main()
{
int x,y;
cout << "enter numbers ";
cin >>x>>y;
if ( y == 8 )
if ( x == 5 )
cout << " @@@@@" << endl;
else
{
cout << "#####" << endl;
cout << "$$$$$" << endl;
cout << "&&&&&" << endl;
}
}

(c)....
#include <iostream>
using namespace std;
int main()
{
int x,y;
cout << "enter numbers ";
cin >>x>>y;
if ( y == 8 )
if ( x == 5 )
cout << " @@@@@" << endl;
else
{
cout << "#####" << endl;
cout << "$$$$$" << endl;
}
cout << "&&&&&" << endl;
}

(d)....

#include <iostream>
using namespace std;
int main()
{
int x,y;
cout << "enter numbers ";
cin >>x>>y;
if ( y == 8 )
if ( x == 5 )
{
cout << "#####" << endl;
cout << "$$$$$" << endl;
cout << "&&&&&" << endl;
}
}

07....
2
4
8
16
32
64
128
256
512
1024
2048
4096
8192
16384
32768
65536
131072
2097152
4194304
8388608
16777216
33554432
67108864
13421728
268435456
536870912
1079741824
-214748364

08......

#include<iostream>
using namespace std;
void main()
{int number,d1,d2,d3,d4,s,t;
cout<<"enter the decrypted number"<<endl; //must be a four digit number;
cin>>number;
d1=number/1000;
number=number%1000;
d2=number/100;
number=number%100;
d3=number/10;
number=number%10;
d4=number;
d1=d1+7;
d2=d2+7;
d3=d3+7;
d4=d4+7;
d1=d1%10;
d2=d2%10;
d3=d3%10;
d4=d4%10;
s=d1;
d1=d3;
s=d3;
t=d2;
d2=d4;
t=d4;
cout<<" the encrypted number is " <<s<<t<<<<d4;
}

string=number;
if( number[0]==number[4] && number[1]==numbre[3])
cout<< " the number is palindrome " <<"\n";

You might also like