Certainly! Below is a simple C program that checks whether a given ID and password are correct. In this example, the correct ID is “6789” and the correct password is “1234”. The program prompts the user to enter an ID and a password, compares them with the correct values, and then prints a message indicating whether the login is successful or not.
Program :
#include<stdio.h>
#include<conio.h>
main()
{
int id,pass;
printf(“Enter ID : “);
scanf(“%d”,&id);
printf(“Enter Password : “);
scanf(“%d”,&pass);
//Here ID is 6789 & Password is 1234.
switch(id)
{
case 6789:
switch(pass)
{
case 1234:
printf(“Login Success ! \n Correct ID & Password”);
break;
default: printf(“Wrong Password!”);
}
break;
default:
printf(“Wrong ID.”);
}
}