Write a program to input id from the user. If the id is correct, ask for the password else print "INCORRECT USER ID". If id and pass inputted are correct print "LOGIN SUCCESSFUL" else print "INCORRECT PASSWORD".("id=A and pass= 101")

First ask the user for the id, if the id is correct enter the if body ask for the password and check the password. Display "LOGIN SUCCESSFUL" or "INVALID PASSWORD" as per  the condition.
If the id is not correct then display "INVALID USER ID".

#include<stdio.h>
void main()
{
  char id;
  int pass;

  printf("Enter user id and password");
  scanf("%c %d", &id, &pass);

  if(id=='A')
  { 
    if(pass==101)
    printf("\nLOGIN SUCCESSFUL");
    
    else
    printf("\nINVALID PASSWORD");
  }
  
  else
   {
     printf("\nINVALID USER ID");
    }
}

 


Post a Comment

0 Comments