Monday, January 3, 2011

#include
#include
# include
void main()
{
int i,j,f,att,a,b=0,c,d;
char g,h,n,pass[50]="1234";
clrscr(); p:
printf("\n enter the password");
for(i=0;pass[i]!='\0';i++);
for(f=0,j=0;j {
g=getch();
printf("*");
if(g!=pass[j])
f=1;
if(f==0)
{
clrscr();
printf("\n welcome to the program");
printf("\n enter the no : ");
scanf("%d",&a);
printf("\n press 1 for reverse");
printf("\n press 2 for palindrome");
printf("\n press 3 for armstrong ");
printf("\n press 4 for exit");
fflush(stdin); scanf("%c",&n);
if(n=='1')
{
while(a>0)
{
c=a%10;
b=(b*10)+c;
a=a/10;
}
printf("\nreverse=%d",b);
}
if(n=='2')
{
d=a;
while(a>0)
{
c=a%10;
b=(b*10)+c;
a=a/10; \
}
if(b==d)
printf("\n palindrome");
else printf("\n not palindrome");
}
if(n=='3')
{
d=a;
while(a>0)
{
c=a%10;
b=b+c*c*c;
a=a/10;
}
if(b==d)
printf("\n armstrong");
else
printf("\n not armstrong");
}
if(n=='4')
{
exit(0);
}
}
else
printf("\n invalid passward");
printf("\ndo u want to try again");
printf("\n press y/n : ");
fflush(stdin);
scanf("%c",&h);
att=1;
while(h=='y')
{
if(att<=3)
{
printf("\n renter the passward");
att++;
goto p;
}
else
printf("sorry ur passwad doesn't match");
}
getch();
}