===========================================================================
CODING
#include<all.h>
void main()
{
label:
textcolor(WHITE);
clrscr();
int n=0,a=0,large=0,min=0,x=0,y=0,i;
cprintf("Enter number of obs.: ");
cscanf("%d",&n);
if(n<=1)
{
cprintf("WRONG INPUT");
getch();
goto label;
}
for(i=1,x=3,y=3;i<=n;i++,x=x+10)
{
gotoxy(x,y);
cprintf("------");
gotoxy(x,y+1);
cprintf("| |");
gotoxy(x,y+2);
cprintf("------");
gotoxy(x+2,y+1);
cscanf("%d",&a);
if(i==1)
{
large=a;
min=a;
}
else
{
if(a>=large)
large=a;
else
large=large;
if(a<=min)
min=a;
else
min=min;
if(x<=75 &&x>=72)
{
y=y+5;
x=-7;
}
}
}
textcolor(RED+BLINK);
gotoxy(30,18);
cprintf("-------");
gotoxy(30,19);
cprintf("| MAX |");
gotoxy(30,20);
cprintf("|-----|");
gotoxy(30,21);
cprintf("| |");
gotoxy(30,22);
cprintf("| |");
gotoxy(30,23);
cprintf("-------");
gotoxy(33,22);
cprintf("%d",large);
textcolor(GREEN+BLINK);
gotoxy(50,18);
cprintf("-------");
gotoxy(50,19);
cprintf("| MIN |");
gotoxy(50,20);
cprintf("|-----|");
gotoxy(50,21);
cprintf("| |");
gotoxy(50,22);
cprintf("| |");
gotoxy(50,23);
cprintf("-------");
gotoxy(53,22);
cprintf("%d",min);
getch();
getch();
}
CODING
#include<all.h>
void main()
{
label:
textcolor(WHITE);
clrscr();
int n=0,a=0,large=0,min=0,x=0,y=0,i;
cprintf("Enter number of obs.: ");
cscanf("%d",&n);
if(n<=1)
{
cprintf("WRONG INPUT");
getch();
goto label;
}
for(i=1,x=3,y=3;i<=n;i++,x=x+10)
{
gotoxy(x,y);
cprintf("------");
gotoxy(x,y+1);
cprintf("| |");
gotoxy(x,y+2);
cprintf("------");
gotoxy(x+2,y+1);
cscanf("%d",&a);
if(i==1)
{
large=a;
min=a;
}
else
{
if(a>=large)
large=a;
else
large=large;
if(a<=min)
min=a;
else
min=min;
if(x<=75 &&x>=72)
{
y=y+5;
x=-7;
}
}
}
textcolor(RED+BLINK);
gotoxy(30,18);
cprintf("-------");
gotoxy(30,19);
cprintf("| MAX |");
gotoxy(30,20);
cprintf("|-----|");
gotoxy(30,21);
cprintf("| |");
gotoxy(30,22);
cprintf("| |");
gotoxy(30,23);
cprintf("-------");
gotoxy(33,22);
cprintf("%d",large);
textcolor(GREEN+BLINK);
gotoxy(50,18);
cprintf("-------");
gotoxy(50,19);
cprintf("| MIN |");
gotoxy(50,20);
cprintf("|-----|");
gotoxy(50,21);
cprintf("| |");
gotoxy(50,22);
cprintf("| |");
gotoxy(50,23);
cprintf("-------");
gotoxy(53,22);
cprintf("%d",min);
getch();
getch();
}
===========================================================================
No comments:
Post a Comment