title: Simple login program using C
body: <p>So, I'm working on an extra lab task which require me to build a simple login program to read studentID and password using C. i tried to use strcmp() to verify the ID and password but even tho the elements compared are correct, the program will always display "Wrong Password". Please help me take a look on my program, any helps are appreciated. Thanks in advance</p>
  
  <p>Following are my coding:</p>
  
  <pre><code>#include&lt;stdio.h&gt;
  #include&lt;conio.h&gt;
  #include&lt;string.h&gt;
  
  int main()
  {
      char studentID[]="Clarance", password[]="123456", id[8], p[6];
      int n=1, x, y;
  
      do{
           printf("\nStudent_ID:");
           scanf("%s", &amp;id);
  
           printf("\nPassword:");
           scanf("%s", &amp;p);
  
           x=strcmp(id, studentID);
           y=strcmp(p, password);
  
           if(x==0 &amp;&amp; y==0){
             printf("\nSucessfully Logged In");
           }else {
             printf("\nWrong Password, try again", 5-n);
              getch();
              n++;}
  
           if(n&gt;5){
            printf("\nAccess Denied");
            getch();
            }
  
         }while (n&lt;=5);
  
  }
  </code></pre>