ADVERTISEMENT

ADVERTISEMENT

ADVERTISEMENT

C program to make a beep sound

Generate beep sound in C language: Here, we are going to learn how to make a beep sound in C programming language?
Submitted by Nidhi, on July 21, 2021

Problem Solution:

The "\a" escape sequence is used to make a beep sound i.e., it is used to generate a tone sound on the speaker. The beep sound can be used for the debugging or any other purpose.

Program:

The source code to make a beep sound is given below. The given program is compiled and executed using GCC compile on UBUNTU 18.04 OS successfully.

// C program to make beep sound

#include <stdio.h>

int main(int argc, char* argv[])
{
    printf("Beep sound started\n");
    printf("\a");
    printf("Beep sound stopped\n");

    return 0;
}

Output:

Beep sound started
Beep sound stopped

Explanation:

In the main() function, we used "\a" escape sequence to make a beep sound.

C Basic Programs »


ADVERTISEMENT



ADVERTISEMENT



Comments and Discussions

ADVERTISEMENT

ADVERTISEMENT

ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT

Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© https://www.includehelp.com some rights reserved.