C Programming Code Examples
Learn C Language
clrscr() Function in C Programming Language
clrscr() Function in C
Function clrscr() clears the screen and moves the cursor to the upper left-hand corner of the screen. If you are using the GCC compiler, use system function to execute the clear/cls command. clrscr() function is also a non-standard function defined in "conio.h" header. This function is used to clear the console screen. It is often used at the beginning of the program (mostly after variable declaration but not necessarily) so that the console is clear for our output.
Syntax to Clear the Console in C
#include<conio.h>
clrscr();
OR
system("cls");
OR
system("clear");
/* clear the screen and moves the cursor to the upper left-hand corner of the screen by clrscr() function example. */
#include <stdio.h>
// clrscr() function definition
void clrscr(void)
{
system("clear");
}
int main()
{
clrscr(); //clear output screen
printf("Hello World!!!"); //print message
return 0;
}
In this c program, user is asked to entered the number of rows r and columns c. The value of r and c should be less than 10 in this program. The user is asked to enter elements of the...
C program to find sum of all prime numbers between 1 to n using for loop. Prime numbers are positive integers greater than 1 that has only two divisors 1 and the number itself. For
To read the file in C Language, we must open it first using any of the mode, for example if you only want to read the file then open it in "r" mode. Based on the mode selected during
Open the file and point it to the file pointer fpoint1. Initialize the variables line_count, n_o_c_l, n_o_n_b_l, n_o_b_l, n_e_c to zero. Using while loop read the next line character
C program to input a number and find sum of first & last digit of the number using for loop. Input a number from user and store it in some variable say j. Find last digit of given number