C Program to Check Valid User name and Password
Write a Program to Check Valid User name and Password
// C Program to Check Valid User name and Password
#include <stdio.h>
#include <string.h>
int main()
{
int flag1 = 0,flag2 = 0;
char user_name[] = "CodeCrucks";
char user_password[] = "cc@123";
char user_name1[20];
char user_password1[20];
printf("Enter Username :--> ");
gets(user_name1);
printf("Enter Password :--> ");
gets(user_password1);
if((strcmp(user_name, user_name1) == 0) && (strcmp(user_password, user_password1) ==0 ))
{
printf("Success");
}
else
{
printf("Failure");
}
return 0;
}
Output:
Run 1:
Enter Username :--> CodeCrucks
Enter Password :--> cc@123
Success
Run 2:
Enter Username :--> CodeCrucks
Enter Password :--> abc@123
Failure