Friday, August 12, 2016

C program to ring a bell using ASCII value 7.

C program to generate a beep sound.

#include<stdio.h>
int main()
{
  // Following printf will ring a beep sound.
         
  printf("%c", 7);
           
  /* Note: 7 is ASCII value of a beep sound.
  Use a loop to ring a series of beep sound. */

  return 0;
}

Output:

You will listen a beep sound.

2 comments:

  1. Does this even work? I am using TURBO C.

    ReplyDelete
    Replies
    1. As 7 is ASCII value of Beep Sound, you will listen one beep sound for every one %c for ASCII 7. I have tried and its properly working on Windows 7, Dev C++ editor.

      Delete