First c program

File name : eligible.c

#include<stdio.h>
int main()
{
      int num;
      printf("Enter your age: ");
      scanf("%d", &num);
      if (num <18)
      {
             printf("you are not eligible for voting");
      }
      else
      {
             printf("You can vote!!");
      }
      return 0;
}

Output :-

Enter your age:25
You can vote!!

include header file :-

The first line of the program #include is a preprocessor command, which tells a C compiler to include stdio.h file before going to actual compilation.
C program depends upon some header files for function definition. That are used in program. each header file by default is extended with '.h'. The file should be included using #include.
Eg.

#include<stdio.h>

All the definintions and prototypes of function defined in this file are available in the current program.

#include<conio.h>

conio.h is a C header file used mostly by MS-DOS compilers to provide console input/output. It is not part of the C standard library or ISO C, nor is it defined by POSIX. This header declares several useful library functions for performing "console input and output" from a program.





Previous Next

Trending Tutorials




Review & Rating

0.0 / 5

0 Review

5
(0)

4
(0)

3
(0)

2
(0)

1
(0)

Write Review Here


Ittutorial