Computer Science, asked by poulami26, 8 months ago


What are the use of main, Printf, Clrscr and getch functions??
explain ​

Answers

Answered by sakshichoudhary844
1

Answer:

1. printf()    function in C language: In C programming language, printf() function is used to print the (“character, string, float, integer, octal and hexadecimal values”) onto the output screen. We use printf() function with %d format specifier to display the value of an integer variable.

2. h" (console input output header file) used to clear the console screen. It is a predefined function, by using this function we can clear the data from console (Monitor). Using of clrscr() function in C is always optional but it should be place after variable or function declaration only.

3. getch() is a way to get a user inputted character. It can be used to hold program execution, but the "holding" is simply a side-effect of its primary purpose, which is to wait until the user enters a character. getch() and getchar() are used to read a character from screen.

Answered by aburaihana123
0

Answer:

  • main() : The main() function is where the program is executed from.
  • printf(): A library function called printf() is used to display formatted output on screens.
  • clrscr(): The clrscr() function clears the screen and positions the cursor in the top-left corner.
  • getch(): The Output Console is stopped by the getch() method until a key is hit.

Explanation:

Main():

  • The main function is where the program is executed from. By directing calls to other program functions, it often manages how the program is executed.
  • Any information entered at the command prompt following the program name is placed within the parentheses of the main() function.

Printf():

  • A library function called printf() is used to display formatted output on screens.
  • The string is printed within quote marks by the function. We must use the #include stdio directive to include the stdio.h header file in order to use printf() in our program.

clrscr():

  • The console screen can be cleared using clrscr(). The header file #includeconio. h> must be added in order to utilize this method.
  • The clrsr() function is used to clean the console window in the C programming language.
  • It is a predefined function that allows us to clear the  data.

getch() :

  • In a C/C++ programme, the getch() function holds the output screen for a while until the user presses a key on the keyboard to close the console window.
  • We can conceal the characters that users enter in the ATM PIN, password, etc. using the getch() function.

#SPJ2

Similar questions