I have written a program to test whether a password contains upper-case, digits and a `$`. #include <stdio.h> #include <conio.h> #include <ctype.h> #include<string.h> int main() { char pass[20]; //Declaring the array to store pass int i,flag1=0, flag2=0, flag3=0; printf("Please enter a password having a Upper case letter, a number and also a $ sign \n"); scanf("%s",&pass); { for(i=0;i<=strlen(pass);i++) if( isupper(pass[i]) ) flag1=1; else if(isdigit(pass[i])) //Loop to check if all element in pass has a digit, alpha & '$' flag2=1; else if(pass[i]=='$') flag3=1; } { if((flag1==1) && (flag2==1) && (flag3==1)) //All condition true { printf("\nNice Password!"); } else { printf("\nPassword must contain a upper case letter, a number and a $ sign"); //Something missing } } return 0; }