Created
July 17, 2017 01:29
-
-
Save ChintanBharateeya/17dec9f62cf73c86ded9f9e74d1a525c to your computer and use it in GitHub Desktop.
practice program on C
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <ctype.h> | |
#include <stdlib.h> | |
#include <string.h> | |
int main(int argc, char **argv) | |
{ | |
char pword[100]; | |
int uc,d,sp,i=1,maxval=0,l; | |
printf("Please enter the password\n"); | |
scanf( " %s", pword); | |
for ( l=0; pword[l]!= NULL;l++) | |
{ | |
maxval++; | |
} | |
printf("maxval is %d\n",maxval); | |
// printf ("The entered password is %s\n",pword); | |
for(i=0;i<=maxval;i++) | |
{ uc=pword[i]; | |
d=pword[i]; | |
sp=pword[i]; | |
if(isalpha(uc)) | |
{if(isupper(uc)) | |
{ | |
uc=pword[i]; | |
//printf("%c\n",uc); | |
//break; | |
} | |
} | |
else if (isdigit(d)) | |
{ | |
d=pword[i]; | |
//printf("%c\n",d); | |
} | |
else if (sp=='$') | |
{ | |
sp=pword[i]; | |
//printf("%c\n",sp); | |
printf("Correct password\n"); | |
break; | |
}else {printf("Error!!");break;} | |
/* if (isupper(uc)==uc && isdigit(d)==d && sp=='$') | |
{ | |
printf("Correct password"); | |
}else {i++;continue;printf("try again");}*/ | |
} | |
return 0; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <ctype.h> | |
#include <stdlib.h> | |
#include <string.h> | |
int main(int argc, char **argv) | |
{ | |
char pword[100]; | |
int uc,d,sp,i=1,maxval=0,l; | |
printf("Please enter the password\n"); | |
scanf( " %s", pword); | |
for ( l=0; pword[l]!= NULL;l++) | |
{ | |
maxval++; | |
} | |
printf("maxval is %d\n",maxval); | |
// printf ("The entered password is %s\n",pword); | |
for(i=0;i<=maxval;i++) | |
{ uc=pword[i]; | |
d=pword[i]; | |
sp=pword[i]; | |
if(isalpha(uc)) | |
{if(isupper(uc)) | |
{ | |
uc=pword[i]; | |
//printf("%c\n",uc); | |
//break; | |
} | |
} | |
else if (isdigit(d)) | |
{ | |
d=pword[i]; | |
//printf("%c\n",d); | |
} | |
else if (sp=='$') | |
{ | |
sp=pword[i]; | |
//printf("%c\n",sp); | |
printf("Correct password\n"); | |
break; | |
}else {printf("Error!!");break;} | |
/* if (isupper(uc)==uc && isdigit(d)==d && sp=='$') | |
{ | |
printf("Correct password"); | |
}else {i++;continue;printf("try again");}*/ | |
} | |
return 0; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <ctype.h> | |
#include <stdlib.h> | |
#include <string.h> | |
int main(int argc, char **argv) | |
{ | |
char pword[100]; | |
int uc,d,sp,i=1,maxval=0,l; | |
printf("Please enter the password\n"); | |
scanf( " %s", pword); | |
for ( l=0; pword[l]!= NULL;l++) | |
{ | |
maxval++; | |
} | |
printf("maxval is %d\n",maxval); | |
// printf ("The entered password is %s\n",pword); | |
for(i=0;i<=maxval;i++) | |
{ uc=pword[i]; | |
d=pword[i]; | |
sp=pword[i]; | |
if(isalpha(uc)) | |
{if(isupper(uc)) | |
{ | |
uc=pword[i]; | |
//printf("%c\n",uc); | |
//break; | |
} | |
} | |
else if (isdigit(d)) | |
{ | |
d=pword[i]; | |
//printf("%c\n",d); | |
} | |
else if (sp=='$') | |
{ | |
sp=pword[i]; | |
//printf("%c\n",sp); | |
printf("Correct password\n"); | |
break; | |
}else {printf("Error!!");break;} | |
/* if (isupper(uc)==uc && isdigit(d)==d && sp=='$') | |
{ | |
printf("Correct password"); | |
}else {i++;continue;printf("try again");}*/ | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment