===========================================================================
CODING
#include<iostream.h>
#include<conio.h>
#include<math.h>
#include<stdio.h>
#include<process.h>
#include<all.h>
void main()
{
clrscr();
first();
second();
int a[20],j,i,prime,n,x,y,t;
textcolor(WHITE);
gotoxy(1,1);
cprintf("Enter nos.: ");
for(i=0,x=16;i<=10;i++,x+=5)
{
gotoxy(x,1);
cscanf("%d",&a[i]);
}
for(;;)
{
gotoxy(1,3);
cprintf("What do you want to find?\r\n[1]->Even [2]->Prime\r\n[3]-> +ve [4]-> -ve\r\n");
cscanf("%d",&n);
for(i=0,prime=0,t=15,x=1,y=8;i<=10;i++,t=15,prime=0,x+=5)
{
switch(n)
{
case 1:
if((a[i])%2==0)
t=10;
break;
case 2:
if(a[i]>1)
{
for(j=2;j<=sqrt(a[i]);j++)
{
if((a[i])%j==0)
prime=1;
}
if(prime==0)
t=10;
}
break;
case 3:
if(a[i]>=0)
t=10;
break;
case 4:
if(a[i]<0)
t=10;
break;
case 0: exit(0);
default:
t=15;
}
textcolor(WHITE);
if(i==0)
{
gotoxy(x,y);
cprintf("ÕÍÍÍÍ");
gotoxy(x,y+1);
cprintf("³ ");
gotoxy(x+2,y+1);
textcolor(t);
cprintf("%.2d",a[i]);
textcolor(WHITE);
gotoxy(x,y+2);
cprintf("ÔÍÍÍÍ");
}
else if(i==10)
{
gotoxy(x,y);
cprintf("ÑÍÍÍ͸");
gotoxy(x,y+1);
cprintf("³ ³");
gotoxy(x+2,y+1);
textcolor(t);
cprintf("%.2d",a[i]);
textcolor(WHITE);
gotoxy(x,y+2);
cprintf("ÏÍÍÍ;");
}
else
{
gotoxy(x,y);
cprintf("ÑÍÍÍÍ");
gotoxy(x,y+1);
cprintf("³ ");
gotoxy(x+2,y+1);
textcolor(t);
cprintf("%.2d",a[i]);
textcolor(WHITE);
gotoxy(x,y+2);
cprintf("ÏÍÍÍÍ");
}
}
gotoxy(1,6);
cprintf(" ");
}
getch();
}
CODING
#include<iostream.h>
#include<conio.h>
#include<math.h>
#include<stdio.h>
#include<process.h>
#include<all.h>
void main()
{
clrscr();
first();
second();
int a[20],j,i,prime,n,x,y,t;
textcolor(WHITE);
gotoxy(1,1);
cprintf("Enter nos.: ");
for(i=0,x=16;i<=10;i++,x+=5)
{
gotoxy(x,1);
cscanf("%d",&a[i]);
}
for(;;)
{
gotoxy(1,3);
cprintf("What do you want to find?\r\n[1]->Even [2]->Prime\r\n[3]-> +ve [4]-> -ve\r\n");
cscanf("%d",&n);
for(i=0,prime=0,t=15,x=1,y=8;i<=10;i++,t=15,prime=0,x+=5)
{
switch(n)
{
case 1:
if((a[i])%2==0)
t=10;
break;
case 2:
if(a[i]>1)
{
for(j=2;j<=sqrt(a[i]);j++)
{
if((a[i])%j==0)
prime=1;
}
if(prime==0)
t=10;
}
break;
case 3:
if(a[i]>=0)
t=10;
break;
case 4:
if(a[i]<0)
t=10;
break;
case 0: exit(0);
default:
t=15;
}
textcolor(WHITE);
if(i==0)
{
gotoxy(x,y);
cprintf("ÕÍÍÍÍ");
gotoxy(x,y+1);
cprintf("³ ");
gotoxy(x+2,y+1);
textcolor(t);
cprintf("%.2d",a[i]);
textcolor(WHITE);
gotoxy(x,y+2);
cprintf("ÔÍÍÍÍ");
}
else if(i==10)
{
gotoxy(x,y);
cprintf("ÑÍÍÍ͸");
gotoxy(x,y+1);
cprintf("³ ³");
gotoxy(x+2,y+1);
textcolor(t);
cprintf("%.2d",a[i]);
textcolor(WHITE);
gotoxy(x,y+2);
cprintf("ÏÍÍÍ;");
}
else
{
gotoxy(x,y);
cprintf("ÑÍÍÍÍ");
gotoxy(x,y+1);
cprintf("³ ");
gotoxy(x+2,y+1);
textcolor(t);
cprintf("%.2d",a[i]);
textcolor(WHITE);
gotoxy(x,y+2);
cprintf("ÏÍÍÍÍ");
}
}
gotoxy(1,6);
cprintf(" ");
}
getch();
}
===========================================================================
No comments:
Post a Comment