assignement c++

Post on 15-Jul-2015

32 Views

Category:

Education

1 Downloads

Preview:

Click to see full reader

TRANSCRIPT

/*Inverted Triangle*/

#include<iostream.h>

#include<conio.h>

void main()

{

clrscr();

int w=6;

for(int g=0;g<9;g++)

{

cout<<"*";

}

cout<<"\n";

for(int a=1;a<=3;a++)

{

for(int b=0;b<a;b++)

{

cout<<" ";

}

cout<<"*";

for(int c=1;c<w;c++)

{

cout<<" ";

}

cout<<"*"<<"\n";

w=w-2;

}

for(int e=1;e<=1;e++)

{

for(int f=4;f>=e;f--)

{

cout<<" ";

}

cout<<"*";

}

getch();

}

/* Triangle */

#include<iostream.h>

#include<conio.h>

int main()

{

clrscr();

int i,j,sp,x=1;

for(i=1;i<=4;i++,x=x+2)

{

for(sp=1;sp<=4-i;sp++) cout<<" ";

for(j=1;j<=x;j++)

{

if(i>1&&i<4&&j>1&&j<x)

cout<<" ";

else

cout<<"*";

}

cout<<"\n";

}

getch();

}

/*Take input of Three n.o if the are not Equal,then find the Smallest

n.o*/

#include<iostream.h>

#include<conio.h>

void main()

{

clrscr();

int a,b,c;

cout<<"Entr 1st n.o = ";

cin>>a;

cout<<"Entr 2nd n.o = ";

cin>>b;

cout<<"Entr 3rd n.o = ";

cin>>c;

if((a<b)&&(a<c))

cout<<"Smallest n.o is = "<<a;

else if((c<a) && (c<b))

{

cout<<"Smallest n.o is = "<<c;

}

else if((b<a) && (b<c))

{

cout<<"Smallest n.o is = "<<b;

}

else

{

cout<<"All n.o are Equal";

}

getch();

}

top related