Program to write a text to a file

We will write a program in C that will accept a string from the user and write the string in a file. In this program, we will use fopen function in order to open a file. We will also use fputs function which will write a string to a file.

Below is the program:

Program to display right angled triangle of star (asterisk)

Below the program in C that will display right angled triangle of star/asterisk. The program will use for and while loop to display the star/asterisk on the screen.

Expected Output

Here is the code,

Program to read text from a file and display it on screen

We will write a program in C that will read a text file character by character and displays it on the screen. In order to achieve it, we will use fopen function that will open the file from the disk. We will also use fgetc function which will read the file character by character and then display the content of the string character by character.