write a program to act as an electronic safe if


Write a program to act as an electronic safe. If the correct code has been entered the program should display "Safe Open".  If an incorrect code is input it should display "Alarm" and cannot be reset.
 
#include stdio.h
void main()

  char prompt;
  int dial,code;
/* set up code */
  printf("Please enter in the numerical code \n\r");
  scanf("%d",&code);
/* Lock up safe */
  printf(" Safe locked \n\r Please enter access ... ");
  scanf("%d",&dial);
  while (dial != code )
  {
    printf("Alarm sounded \n\r");
 
  }
  printf("Safe opened \n\r"); 
  printf("Press any key to exit \n\r");
  scanf("\n%c",&prompt); 
  }

Request for Solution File

Ask an Expert for Answer!!
C/C++ Programming: write a program to act as an electronic safe if
Reference No:- TGS0265312

Expected delivery within 24 Hours