In this program, we used simple codes. We have there the pre-processor command which is the #include and the header files stdio.h and conio.h. There is also our command for output which is the printf. Lastly, to terminate the program getch(); is the key for that. It prompts user to input any character that will not show but rather to terminate the program. Check out the codes below.
1: #include <stdio.h>
2: #include <conio.h>
3:
4: int main()
5: {
6: printf("Hello World!");
7: getch();
8: }
When the program is run it will automatically show the phrase Hello World! because under the main function only printf is the present command that will be generated in the program to make an action. To terminate the program you can just simply enter any character to trigger the command. Check out the sample output below.
Hope you learned something. Feel free to leave a comment below. Thanks!
No comments:
Post a Comment
Please do leave a comment. It's gonna be a friendly conversation between programmers. Hope you do find our blog helpful. Thank you!