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

2 votes
360 views
Anonymous User asked 07-Dec-2017 in programming by Anonymous User

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

1 Answer

0 votes
Arti Mishra answered 25-Aug-2018 by Arti Mishra
#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");
}

UTKARSHASINGHROUL commented 19-Jun-2019 by UTKARSHASINGHROUL
Thank you for the answer.
       0