What is the use of #include keyword in c programming?

Asked 07-Dec-2017
Viewed 603 times

1 Answer


0

#include keyword in C Programming
#include keyword is the pre-defined keyword in C Language. That is used for allowing the pre-processor to copy the content of header files in the current source code where the #include keyword is used.

Syntax of #include keyword  
#include <header_file_name>
OR
#include "header_file_name"

A list of header file names

What is the use of #include keyword in c programming?

Example:
Here is the simple example where we are using #include keyword or directory to check the number is perfect number or not.

#include<stdio.h>
#include<conio.h>
Void main()
{
int number, remainder, sum = 0, i;
clrscr(); // use for clear the console window
printf(“Enter Any Number : “);
scanf(“%d”,&number);
for(i=1;i<=number/2;i++)
{
remainder = number % i;
sum = sum + i;
}
if (sum == number)
        printf("Entered Number is perfect number");
   else
        printf("Entered Number is not a perfect number");
}


Comment
Thank you for the answer. - Anonymous User19-Jun-2019